+~

Irrationally out-of-sync phasors

Two oscillators with a ratio of frequencies that's an irrational number will never have exactly the same phase relationship. So, phasor~ objects that have an irrational frequency relationship, when combined, will create a rhythm that never exactly repeats. In this example, you can hear that the sum of the two phasor~ objects with a constantly changing relationship will create a constantly changing rhythm.

Hanning function to control parameters of a sound

If you scale a one cycle of cosine wave by a factor of -0.5 and offset it by 0.5 you get a "Hanning function", which goes from 0 to 1 and back to 0 as smoothly as possible. That can be used to shape the amplitude of a sound, turning it on and off smoothly, or it can be used to modulate any characteristic of the sound.

Frequency modulation of sinusoidal tones

Frequency modulation is the use of one oscillator—usually but not obligatorily at a sub-audio frequency—to modify the frequency of a sound. The modulating oscillator is added to a main frequency value to create a frequency that fluctuates up and down from the central value. The result, at low modulation rates, is called "vibrato".

Amplitude modulation of sinusoidal tones

Amplitude modulation is the use of one oscillator—usually but not obligatorily at a sub-audio frequency—to modify the amplitude of a sound. (Ring modulation, shown in Multiplication of Sine Tones, is one particular example of amplitude modulation.) The modulating oscillator is added to a main amplitude value to create an amplitude that fluctuates up and down from the central value. The result, at low modulation frequencies, is called "tremolo".

To play two tones, you need two oscillators: two cycle~ objects). To mix them together, simply add the two signals with a +~ object. (For digital signals, addition is mixing.) To control the amplitude, multiply it by some factor, using a *~ object. (Multiplication is amplification.)

Mixing two audio sources

This example shows a simple way to mix two audio sources.

Alter the speed of an audio file

This example demonstrates how to modulate the playback speed of an audio file. The value in the right inlet of sfplay~ determines the playback rate; 1. is normal speed, 0.5 is half speed, 2.0 is double speed, and so on. The rate can be provided as a continuously changing control signal instead of as a single constant value, allowing us to warp the speed at will. Here we're using a cycle~ object to produce a low-frequency sinusoid over the course of ten seconds (i.e. at the frequency of 0.1 Hz).

Synchronize an LFO to a note onset with phasor~

To sync an LFO to the onset of a note, drive it with a phasor~ object. Send a phase value of "0" into the right inlet of phasor~ when the note starts, as seen in this example.

Phase cancellation due to delay

A sinusoid added to a delayed version of itself will result in a sinusoid of the same frequency but with its amplitude altered. The amount of amplitude change will depend on the phase relationship between the original sinusoid and its delayed copy. The two sinusoids will interfere with each other either constructively (reinforcing each other) or destructively (tending to cancel each other).

Continuous change of delay time causes a pitch shift

The way we commonly avoid clicks when changing the amplitude of a sound is to interpolate smoothly sample-by-sample from one gain factor to another, using an object such as line~. Does that same technique work well for making a smooth change from one delay time to another? As it turns out, that's not the best way to get a seamless unnoticeable change from one delay time to another, because changing the delay time gradually will actually cause a pitch shift in the sound.