Instance Property


The audio playback rate.


var rate: Float { get set }


The varispeed audio unit resamples the input signal, as a result changing the playback rate also changes the pitch. For example, changing the rate to 2.0 results in the output audio playing one octave higher. Similarly changing the rate to 0.5, results in the output audio playing one octave lower.

The pitch is measured in “cents”, a logarithmic value used for measuring musical intervals. One octave is equal to 1200 cents. One musical semitone is equal to 100 cents.

Using the rate value you calculate the pitch (in cents) using the formula pitch = 1200.0 * log2(rate). Conversely, you calculate the appropriate rate for a desired pitch with the formula rate = pow(2, cents/1200.0).

The default value is 1.0. The range of values is 0.25 to 4.0. The unit of rate is unspecified.

See Also