asig[,acmp] sndwarp xamp, xtimewarp, xresample, ifn1, ibeg,\ iwsize, irandw, ioverlap, ifn2, itimemode asig1,asig2[,acmp1,acmp2] sndwarpst xamp, xtimewarp, xresample, ifn1,\ ibeg, iwsize, irandw, ioverlap, ifn2, itimemode
ibeg is the time in seconds to begin reading in the table (or soundfile). When itimemode is non- zero, the value of itimewarp is offset by ibeg.
iwsize is the window size in samples used in the time scaling algorithm.
irandw is the bandwidth of a random number generator. The random numbers will be added to iwsize.
ioverlap determines the density of overlapping windows.
ifn2 is a function used to shape the window. It is usually used to create a ramp of some kind from zero at the beginning and back down to zero at the end of each window. Try using a half a sine (ie: f1 0 16384 9 .5 1 0) which works quite well. Other shapes can also be used.
acmp in sndwarp and acmp1, acmp2 in sndwarpst, are single layer (no overlaps), unwindowed versions of the time and/or pitch altered signal. They are supplied in order to be able to balance the amplitude of the signal output, which typically contains many overlapping and windowed versions of the signal, with a clean version of the time-scaled and pitch-shifted signal. The sndwarp process can cause noticeable changes in amplitude, (up and down), due to a time differential between the overlaps when time-shifting is being done. When used with a balance unit, acmp, acmp1, acmp2 can greatly enhance the quality of sound. They are optional, but note that in sndwarpst they must both be present in the syntax (use both or neither). An example of how to use this is given below.
xamp is the value by which to scale the amplitude (see note on the use of this when using acmp, acmp1, acmp2).
xtimewarp determines how the input signal will be stretched or shrunk in time. There are two ways to use this argument depending upon the value given for itimemode. When the value of itimemode is 0, xitimewarp will scale the time of the sound. For example, a value of 2 will stretch the sound by 2 times. When itimemode is any non-zero value then xtimewarp is used as a time pointer in a similar way in which the time pointer works in lpread and pvoc. An example below illustrates this. In both cases, the pitch will NOT be altered by this process. Pitch shifting is done independently using xresample.
xresample is the factor by which to change the pitch of the sound. For example, a value of 2 will produce a sound one octave higher than the original. The timing of the sound, however, will NOT be altered.
iwindfun=1 isampfun=2 ibeg=0 iwindsize=2000 iwindrand=400 ioverlap=10 awarp line 1, p3, 1 aresamp line 1, p3, 2 kenv line 1, p3, .1 asig sndwarp kenv,awarp,aresamp,isampfun,ibeg,iwindsize,iwindrand, \ ioverlap,iwindfun,0Now, here's an example using xtimewarp as a time pointer and using stereo:
itimemode = 1 atime line 0, p3, 10 asig1, asig2 sndwarpst kenv, atime, aresamp, sampfun, ibeg, \ iwindsize, iwindrand, ioverlap, \ iwindfun, itimemodeIn the above, atime advances the time pointer used in the sndwarp from 0 to 10 over the duration of the note. If p3 is 20 then the sound will be two times slower than the original. Of course you can use a more complex function than just a single straight line to control the time factor.
Now the same as above but using the balance function with the optional outputs:
asig,acmp sndwarp 1,awarp,aresamp,isampfun,ibeg,iwindsize,iwindrand,\ ioverlap,iwindfun,itimemode abal balance asig, acmp asig1,asig2,acmp1,acmp2 sndwarpst 1, atime, aresamp, sampfun,\ ibeg, iwindsize, iwindrand, \ ioverlap, iwindfun, itimemode abal1 balance asig1, acmp1 abal2 balance asig2, acmp2In the above two examples notice the use of the balance unit. The output of balance can then be scaled, enveloped, sent to an out or outs, and so on. Notice that the amplitude arguments to sndwarp and sndwarpst are "1" in these examples. By scaling the signal after the sndwarp process, abal, abal1, and abal2 should contain signals that have nearly the same amplitude as the original input signal to the sndwarp process. This makes it much easier to predict the levels and avoid samples out of range or sample values that are too small.
More advice: Only use the stereo version when you really need to be
processing a stereo file. It is someone slower than the mono version and
if you use the balance function it is slower again. There is nothing wrong
with using a mono sndwarp in a stereo orchestra and sending the
result to one or both channels of the stereo output!
AUTHOR:
Richard Karpen
Seattle, Wash
1997