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

sync~

Synchronize MSP with an external source

Description

sync~ outputs a 0-1 ramp, like phasor~. The frequency of the ramp can be specified in beats per minute (BPM), or by sending sync~ a tempo reference via tap tempo, MIDI beat clock, or an audio signal containing a 'click track.' Also, sync~ generates MIDI beat clock to synchronize external devices.

Arguments

None.

Messages

bang A sequence of bang messages is used to set the tap tempo. A bang message is interpreted as one tap. If the sync~ object receives three taps in a row with reasonably consistent timing, it changes the tempo to match them.
int MIDI-data [int]
MIDI beat clock. Integer input is interpreted as MIDI data - you can directly connect the output of an rtin object. sync~ responds to MIDI beat clock start/stop (int 250 and 252), and tick (248). All other values are ignored.
float beats-per-minute [float]
Sets the BPM for the clock.
bpm bpm-rate [float]
The word bpm, followed by a number, sets the rate of the current output ramp to a frequency corresponding to the specified beats/minute.
midioffset output-phase [float]
The word offset, followed by a floating point number in the range 0.-1.0, adjusts the MIDI output "phase" of the current output ramp.
offset ramp-phase [float]
The word offset, followed by a floating point number in the range 0.-1.0, adjusts the "phase" of the current output ramp.
ppq number-of-ticks-per-quarter-note [int]
The word ppq (parts per quarter), followed by a number, specifies the number of ticks output for each quarter note. By default, MIDI beat clock specifies a PPQ of 24. The ppq message is useful mainly for doubling or halving the tempo for an external device that is set to a different time signature. The ramp signal generated by the sync~ object can be scaled for output further by using the rate~ object.
signal The sync~ object will set its tempo to match an audio click track input. The click track should contain amplitude peaks at quarter-note intervals of the desired tempo. Signal input will affect the tempo only if sync~ detects peak values greater than 0.1 and within the tempo range of approximately 30-240 BPM.
start The word start causes the current output ramp to halt, and resets the ramp to 0. The start message has the same effect as receiving the MIDI beat clock start value (250). When the start message is received, sync~ outputs the number 250 from the MIDI beat clock output so that any external devices will also start.
stop The word stop causes the current output ramp to halt, and to remain stationary until a start message is received. It is equivalent to sending the MIDI beat clock stop value (252). When the stop message is received, the sync~ object sends the number 252 from its MIDI beat clock output. The sync~ object does not send MIDI beat clock ticks while it is stopped.

Information for box attributes common to all objects

Output

bpm: Out middle outlet: Whenever the tempo changes, sync~ outputs the message bpm, followed by a float value that specifies the new tempo.
click: Out middle outlet: When the sync~ object receives an audio click, it sends a click message out the middle outlet.
int: Out right outlet: sync~ generates a MIDI beat clock stream that matches its output ramp. Typically, when needed, this outlet is connected directly to a midiout object.
midi: Out middle outlet: When the sync~ object receives a MIDI beat clock tick, it sends a midi message out the middle outlet.
signal: Left outlet: Like the phasor~-object, the sync~ object generates a sawtooth waveform that increases from 0 to 1 for each quarter note of the current tempo. This ramp can be scaled as necessary with the rate~ object, for use with wave~ and other objects.
tap: Out middle outlet: When the sync~ object receives a tap, it sends a tap message out the middle outlet.

Examples

See Also

Name Description
midiout Transmit raw MIDI data
phasor~ Sawtooth wave generator
rate~ Time-scale the output of a phasor~
rtin Output received MIDI real time messages
seq Sequencer for recording and playing MIDI data
transport Control a master clock and report time values.
wave~ Variable size wavetable