rescale - convert 32-bit float to 16-bit integer sound file
rescale [ -P desired_peak ] [ -p input_peak ] [ -f factor ] [ -r ] [ -t ] [ -s input_skip ] [ -o output_skip ] [ -d duration ] [ -e end_silence ] [ -h ] input_file [ output_file ]
This command-line utility converts a 32-bit floating-point sound file to 16-bit integer. It does this by first scaling every sample by a factor, and then chopping off the portion to the right of the decimal point. (So if the factor is 1, a sample of 22091.428915 becomes 22091.)
There are several options that affect what factor rescale uses, where the output goes, and whether to dither before truncating from 32 bits.
This file has the same header format as the input file, as long as that is one of the types that RTcmix can write (AIFF, AIFC, WAVE, NeXT, IRCAM). If it's a type that RTcmix can read, but not write, then the output format will be AIFF.
rescale foo.wav
Assuming "foo.wav'' is a 32-bit float file, this command rescales the file so that its peak amplitude is 32767, and writes the 16-bit output to "foo.wav.rescale.''
rescale -r -f 1 foo.wav
rescales "foo.wav'' using a factor of 1.0 (i.e., it merely drops digits of precision to the right of the decimal point), and writes the output to "foo.wav,'' overwriting the original 32-bit file.
rescale -P 20000 -t foo.wav newfoo.wav
rescales "foo.wav'' so that its peak amplitude is 20000, and writes the output to a new file, "newfoo.wav.'' Before truncating to 16 bits, applies the dithering algorithm to each sample.
John Gibson <johgibso at indiana edu>, based on the original Cmix rescale, but revised and expanded.