translen

Return the projected duration of a transposed (interpolated) sound.


Synopsis

val = translen(original_length, tranposition_interval)


Description

translen returns the duration of a transposed (pitch-shifting via interpolation — see the TRANS or TRANS3 instruments) sound given the original_length (in seconds) and transposition_interval (in octave.pitch-class notation — i.e., -0.07 will shift downwards by a perfect fifth).

For example, if you transpose a sound down an octave (-1.00) with TRANS, it will create two seconds of output for every one second of input. The duration that you pass to TRANS is the duration of the output. You use translen if you want to consume a particular duration of the input sound, regardless of the duration of the resulting output. Say you had a one-second recording of someone saying “RTcmix rocks!” If you want to transpose this down an octave, you could do it two ways:

   duration = 1
   TRANS(start, inskip, duration, amp, transp)

…or…

   duration = 1
   TRANS(start, inskip, translen(duration, transp), amp, transp)

The first example would give you one second of output, but it would truncate the sentence in the middle, after a half second of sound is consumed. The second example gives you the entire sentence, with the translen call telling TRANS to run for two seconds in order to consume the entire input sound.

If you were to transpose the sound up an octave instead, then passing a duration of one to TRANS would give you a one-second sound, but the second half of that sound would be silent, since it takes only a half second to play the entire sentence when transposed up an octave. Using translen here with a one-second duration argument would cause TRANS to run for a half second, ensuring that any envelope table will span the sentence, rather than having the sentence end in the middle of the envelope, causing a click.


Arguments


Examples

   newlength = translen(7.8, -0.05)

(and see the DESCRIPTION section above for additional examples.)


See Also

DUR, filedur, TRANS