Use stored waveform for a synthesizer

This patch demonstrates the technique of wavetable synthesis: using one cycle of a stored waveform as the wave type for a synthesizer tone. The cycle~ object with no argument produces a cosine wave; however, cycle~ can also refer to a waveform stored in a buffer~, and use that as a wavetable. To do that, you need to create a buffer~, store a waveform in it, and then refer to that buffer~ by creating a cycle~ with the same name.

Simple amplitude control

When you're changing the amplitude of a sound, if the amplitude is changed very suddenly and significantly, it may create a sudden discontinuity in the waveform which will be heard as a high-frequency click. (That phenomenon is demonstrated in the example "Click resulting from amplitude change".) To avoid that problem, it's necessary to interpolate sample-by-sample from the old amplitude value to the new value, over some small period of time, to create a slightly more gentle fade to the new amplitude factor.

List audio cue points

To set a list of cue points in an audio file and have them played in order, use either sfplay~ (with a set of cues established by preload messages to sfplay~ or to sflist~) or buffer~ (with start messages to play~, the parameters of which are stored in a coll).

Timed linear fade

This patch shows how to make a fade-in or a fade-out using the line object (for numbers) or line~ (for a signal). You provide the line (or line~) object with a two-item list signifying a destination value and an amount of time, in milliseconds, to get to the destination.