TRANS/TRANS3 - transposing instrument
TRANS(outskip, inskip, outdur, ampmult, transposition
TRANS3(outskip, inskip, outdur, ampmult, transposition [, inchan, stereoloc ])
Function table 1 gives amplitude curve.
TRANS transposes the input for the specified output duration (outdur), starting at the input start time (inskip).
TRANS transposes by second-order polynomial interpolation. It does not maintain the input duration, so it's sort of like changing tape speed. To transpose down, it interpolates samples between existing ones; to transpose up, it discards some existing samples. When transposing up, then, it must consume more than outdur seconds of samples, and this means that it's possible to run off the end of the input file.
It also means that you can use this instrument only with input from a sound file, not with a real-time input (microphone or aux bus) -- at least not without hearing clicks. (That's because you can't read samples that haven't happened yet.)
TRANS uses the curve provided in function table 1 to scale the amplitudes of the input source. Use setline, setexp, or makegen to create function table 1. If this table has not been created, no amplitude scaling (other than that given by ampmult) will occur.
The output of TRANS can be either mono or stereo.
[note: TRANS3 has the same syntax as TRANS and is used in the same fashion. The difference is that TRANS3 uses 3rd-order interpolation to achieve the pitch-shift. This is s a bit more expensive computationally, but it does produce smoother results.]
rtinput("a_stereo_sound")
trans = -0.02 TRANS(outskip=1, inskip=2, dur=4, amp=1, trans, inchan=0, loc=0)
This transposes the left channel of the stereo input file down by two semitones, starting at a point 2 seconds from the beginning of the file and continuing for 4 seconds. It pans the sound hard right.
Douglas Scott <netdscott-at-netscape.net>