Changing the speed and length very accurately

Audacity has a “Change Speed” effect, but it is only accurate to three decimal places. For greater accuracy a short Nyquist script can be used in the Nyquist Prompt effect.

In this example the length of the selected audio was 599.999 seconds and I wanted to stretch it to 600 seconds duration.
The durations may be in any units (samples, seconds, minutes,… ) as long as both “current-duration” and “target-duration” are both in the same units and each is a decimal number.

A slightly shorter version to save typing:

This shorter version uses shorter, but hopefully still obvious variable names dur replacing current-duration and new-dur replacing target-duration.

The length of the names of variables has no effect on the speed or efficiency of the code and only a minuscule effect on the file size, so as a rule it is recommended that variable names should be as long as is necessary for their meaning to be clear. The same applies to function names and macro names.

It also uses the PSETQ command, which is much like the regular SETQ command except that it allows multiple symbols to be bound to values in parallel.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.