A newer version of Max is available. Click here to access the latest version of the documentation

retune~ Reference

Ztx-based pitch detection and pitchshift



standard pitch [int]

Reference tuning in Hz, the default is 440 Hz.


correction_ambience_threshold [float] (default: 0.3)

Set the automatic bypass when the signal contains too much noise or background ambience (reverb). A value between 0.2 and 0.4 is usually a good starting point. Range: (-10...10).

correction_amount [float] (default: 100.)

Set the amount of pitch correction. 0 means no correction, 100 means full correction.

correction_bypass [float] (default: 100.)

Define the sibilance threshold at which the original signal is passed through unaffected. This bypass switch is required to make sure that sibilances in vocal recordings don’t sound too processed. A default setting of 100 is good.

correction_threshold [float] (default: 0.)

Define the threshold at which the correction takes effect. For most applications this should be set to 0 as this will correct notes that are more that 0 cent off, wrt their ideal pitch. A setting of 10 will allow a pitch deviation of 10 cents in either direction before the correction takes effect.

enablednotes [36 atoms] (default: all)

Either the keyword “all” or a list of notes in the range from 0 to the size of the current scale minus 1 (0 .. 11 in the case of a chromatic scale) determines which notes retune will quantize to. That list may also be sent in the form of a message (e.g. enablednotes 0 2 3 5 7 9 10 ).

notebase [int]

Base note for the currently used scale. Possible values:

0 = 'C'
1 = 'C#'
2 = 'D'
3 = 'D#'
4 = 'E'
5 = 'F'
6 = 'F#'
7 = 'G'
8 = 'G#'
9 = 'A'
10 = 'A#'
11 = 'B'

notelist [36 symbols]

A list of note values or relations is used to specified the scale values used for retuning. The format follows the format used in the Scala definition standard.
Chromatic Scale: 100 200 300 400 500 600 700 800 900 1000 1100
Major Scale: 200 400 500 700 900 1100
Pythagorean Major Scale: 9/8 81/64 4/3 3/2 27/16 243/128

pitchdetection [int]

Returns the average pitch of the segment that is currently being analyzed. This can be used as a pitch detector. A return value of 0.0 means that no coherent pitch could be estimated. You should expect an output fundamental frequency in the range of 50 Hz to 1000 Hz. Please note that this feature is experimental and might produce unpredictable results. In particular, it might introduce octave errors for the measured pitch depending on the input signal. Output as a signal from the second outlet.

quality [int]

Sets the relative quality for retuning operations.
Possible values:

'basic' ( Basic quality for retuning calculations (the default) )
'good' ( Good quality for retuning calculations )
'better' ( Better quality for retuning calculations )
'best' ( Highest quality for retuning calculations )

reportlatency [int]

Enable (1) or disable (0) sending latency information out the right outlet of the retune~ object. Latency is reported in samples.

retune [int]

Enable (1) or disable (0) retuning.

use_16bit [int]

Enable (1) or disable (0) 16-bit processing. Better CPU performance can be obtained by using 16-bit processing, and it is reccomended if you are using the object for pitch detection and not retuning.

windowsize [int] (default: 0)

Specifies the window size to be used for retuning calculations. The range is between 16 samples and the currently used signal vector size.

Common Box Attributes

annotation [symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

background [int] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 removes it. Objects in the background layer are shown behind all objects in the default foreground layer.

color [4 floats]

Sets the color for the object box outline.

fontface [int]

Sets the type style used by the object. The options are:

bold italic Possible values:

0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'

fontname [symbol]

Sets the object's font.

fontsize [float]

Sets the object's font size (in points). Possible values:


hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

hint [symbol]

Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.

ignoreclick [int] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

jspainterfile [symbol]

JS Painter File

patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

position [2 floats]


Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.

presentation [int] (default: 0)

Sets whether an object belongs to the patcher's presentation.

presentation_rect [4 floats] (default: 0. 0. 0. 0.)

Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.

rect [4 floats]


Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).

size [2 floats]


Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.

textcolor [4 floats]

Sets the color for the object's text in RGBA format.

textjustification [int]

Sets the justification for the object's text. Possible values:

0 = 'left'
1 = 'center'
2 = 'right'

varname [symbol]

Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.




MIDI note [list]
MIDI notes as list e.g. “60 100” and “60 0” to enable/disable notes in the current notelist. If the default 12 tone chromatic scale is active, sending the note C3 (60) will enable note 0 (60 modulo 12), which is C.


Go back to the default 12 note chromatic tuning.


The flush message is used in conjunction with sending MIDI notes and will re-enable all notes in a scale.


Report the latency in samples introduced by the retune~ object out the rightmost outlet.


Signal values in the second or third inlets are used to lock the retuned signal to a specific pitch (Hz) (inlet 2) or to de fine detune modulation (inlet 3) values (Cents).

See Also

Name Description
Sound Processing Techniques Sound Processing Techniques
fbinshift~ Frequency domain frequency shifter for pfft~
freqshift~ Time-domain frequency shifter
fzero~ Fundamental frequency and pitch estimator
gizmo~ Frequency-domain pitch shifter for pfft~
hilbert~ Phase quadrature filter
pitchshift~ Ztx-based real-time pitchshifting