The amplitude of the output of <TT>tabread4~</TT> is controlled by a
second <TT>vline~</TT> object, in order to prevent discontinuities
in the output in case a new event is started while the previous event is still
playing. The ``cutoff" <TT>vline~</TT> object ramps the output down to zero
(whether or not it is playing) so that, once the output is zero, the index
of the wavetable may be changed discontinuously.
<P>
In order to start a new ``note", first, the ``cutoff" <TT>vline~</TT> object is
ramped to zero; then, after a delay of 5 msec (at which point <TT>vline~</TT> has reached zero) the phase is reset. This is done with two messages: first,
the phase is set to 1 (with no time value so that it jumps to 1 with no
ramping). The value ``1" specifies the first readable point of the wavetable,
since we are using 4-point interpolation. Second, in the same message box,
the phase is ramped to 441,000,000 over a time period of 10,000,000 msec. (In
Pd, large numbers are shown using exponential notation; these two appear as
4.41e+08 and 1e+07.) The quotient is 44.1 (in units per millisecond) giving
a transposition of one. The upper <TT>vline~</TT> object (which generates the
phase) receives these messages via the ``r phase" object above it.
<P>
The example assumes that the wavetable is ramped smoothly to zero at either
end, and the bottom right portion of the patch shows how to record such a
wavetable (in this case four seconds long). Here a regular (and
computationally cheaper) <TT>line~</TT> object suffices. Although the wavetable
should be at least 4 seconds long for this to work, you may record shorter
wavetables simply by cutting the <TT>line~</TT> object off earlier. The only
caveat is that, if you are simultaneously reading and writing from the same
wavetable, you should avoid situations where read and write operations attack
the same portion of the wavetable at once.
<P>
The <TT>vline~</TT> objects surrounding the <TT>tabread4~</TT> were chosen over <TT>line~</TT> because the latter's rounding of
breakpoints to the nearest block boundary (typically 1.45 msec) can make
for audible aperiodicities in the sound if the wavetable is repeated more than
10 or 20 times per second, and would prevent you from getting a nice, periodic
sound at higher rates of repetition.
<P>
We will return to <TT>vline~</TT>-based sampling in the next chapter, to