From the tradition of analog synthesis comes an elegant, old-fashioned approach to control problems that can be used as an alternative to the control streams we have been concerned with so far in this chapter. Instead, or in addition to using control streams, we can use audio signals themselves to control the production of other audio signals. Two specific techniques from analog synthesis lend themselves well to this treatment: analog sequencing and sample-and-hold.
The analog sequencer [Str95, pp. 70-79] [Cha80, pp. 93,304-308] was often used to set off a regularly or semi-regularly repeating sequence of sounds. The sequencer itself typically put out a repeating sequence of voltages, along with a trigger signal which pulsed at each transition between voltages. One used the voltages for pitches or timbral parameters, and the trigger to control one or more envelope generators. Getting looped sequences of predetermined values in digital audio practice is as simple as sending a phasor~ object into a non-interpolating table lookup. If you want, say, four values in the sequence, scale the phasor~ output to take values from 0 to so that the first fourth of the cycle reads point 0 of the table and so on.
To get repeated triggering, the first step is to synthesize another sawtooth that runs in synchrony with the phasor~ output but four times as fast. This is done using a variant of the technique of Figure 2.8, in which we used an adder and a wraparound operator to get a desired phase shift. Figure 3.8 shows the effect of multiplying a sawtooth wave by an integer, then wrapping around to get a sawtooth at a multiple of the original frequency.
From there is is easy to get to a repeated envelope shape by wavetable lookup for example (using an interpolating table lookup this time, unlike the sequence voltages). All the waveform generation and altering techniques used for making pitched sounds can also be brought to use here.
The other standard control technique from analog synthesizer control is the sample and hold unit [Str95, pp. 80-83] [Cha80, p. 92]. This takes an incoming signal, picks out certain instantaneous values from it, and ``freezes" those values for its output. The particular values to pick out are selected by a secondary, ``trigger" input. At points in time specified by the trigger input a new, single value is taken from the primary input and is output continuously until the next time point, when it is replaced by a new value of the primary input.
In digital audio it is often useful to sample a new value on falling edges of the trigger signal, i.e., whenever the current value of the trigger signal is smaller than its previous value, as shown in Figure 3.9. This is especially convenient for use with a sawtooth trigger, when we wish to sample signals in synchrony with an oscillator-driven process. Pd's sample and hold object was previously introduced in the context of sampling (Example B08.sampler.nodoppler.pd, Page ).