# phasor~

## Triggering events with each cycle of a phasor~

How do we detect, with sample-accurate precision, the precise moment when phasor~ begins a new cycle from 0 to 1? We need to detect the sample on which it leaps from 1 back to 0. However, because phasor~ is constantly interpolating between 0 and 1, it might not leap down to exactly 0. So we can't just use a ==~ object to see when its value is 0.

## Synchronizing MSP audio loops with the transport

This example shows one way you might use phasor~ to make the length of an audio sample loop stay precisely synchronized with the beat of the transport.

## Tempo-relative timing for MSP LFO control

The MSP phasor~ object is frequently used as a low-frequency control signal for audio. Because it is often used to control other signals over a specific period of time, phasor~ can use tempo-relative timing, too. The frequency (rate) of a phasor~ is normally specified in Hertz, but you can alternatively give phasor~ a time interval, using tempo-relative time units, and it will use the inverse of that to determine its frequency.

## Circular quadraphonic panning

For this example to work correctly, you must first download the abstraction quadpan~.maxpat which is explained in the example "Quadraphonic panning based on radial angle", and save it in the Max file search path with the name "quadpan~.maxpat".

## A demonstration of phase distortion synthesis

Phase distortion is a synthesis technique that was used in some Casio synthesizers in the 1980s. In traditional wavetable synthesis, a linear upward ramp signal is used as a phase index to read cyclically through a wavetable containing a particular waveform (a sine wave being the most common). In MSP you can do that by connecting the output of a phasor~ object, which generates a cyclic upward ramp from 0 to 1, to the right (phase offset) inlet of a 0 Hz cycle~ object (containing one cycle of a cosine waveform by default).

## Phase distortion synthesis in a poly~ subpatch

This shows an implementation of phase distortion synthesis in MSP—using the phasor~, kink~, and cycle~ objects—in a patch that is designed to be used inside the poly~ object. For an explanation of this sort of phase distortion synthesis, see “A demonstration of phase distortion synthesis.” The main point of this example, though, is to show how a synthesis patch can be designed to respond directly to MIDI input.