As described in Section 2.3, it is sometimes desirable to use two or more overlapping looping samplers to produce a reasonably continuous sound without having to envelope too sharply at the ends of the loop. This is especially likely in situations where the chunk that is looped is short, a tenth of a second or less. Example B10.sampler.overlap.pd, shown in Figure 2.16 (part a), realizes two looping samplers a half-cycle out of phase from each other. New object classes are:
: output a ``bang" message on load. This is used in this patch to make sure the division of transposition by chunk size will have a valid transposition factor in case ``chunk size" is moused on first.
: evaluate mathematical expressions. Variables appear as $f1, $f2, and so on, corresponding to the object's inlets. Arithmetic operations are allowed, with parentheses for grouping, and many library functions are supplied, such as exponentiation, which shows up in this example as ``pow" (the power function).
: wrap to the interval from 0 to 1. So, for instance, 1.2 becomes 0.2; 0.5 remains unchanged; and -0.6 goes to 0.4.
, , , : signal versions of send and receive. An audio signal sent to a send~ object appears at the outlets of any and all receive~ objects of the same name. Unlike send and receive, you may not have more than one send~ object with the same name (in that connection, see the throw~ and catch~ objects).
In the example, part of the wavetable reading machinery is duplicated, using identical calculations of ``chunk-size-samples" (a message stream) and ``read-pt" (an audio signal smoothed as before). However, the ``phase" audio signal, in the other copy, is replaced by ``phase2". The top part of the figure shows the calculation of the two phase signals: the first one as the output of a phasor~ object, and the second by adding 0.5 and wrapping, thereby adding 0.5 cycles ( radians) to the phase. The two phase signals are each used, with the same range adjustments as before, to calculate indices into the wavetable and the cos~ object, and to control the two samphold~ objects. Finally, the results of the two copies are added for output.