resample(1) resample a 16-bit mono or stereo sound file by an arbitrary factor

SYNOPSIS

resample [-by factor] [-to newSrate] [-f filterFile] [-n] [-l] [-trace] [-version] inputFile [outputFile]

DESCRIPTION

The resample program takes a 16-bit mono or stereo sound file and performs bandlimited interpolation to produce an output sound file have a desired new sampling rate. The output file is in the same format as the input.

OPTIONS

-toSrate
This option or "-byFactor" is required. Specify new sampling rate in samples per second. The conversion factor is implied and will be set to the new sampling rate divided by the sampling rate of the input soundfile.

-byFactor
Specify conversion factor. This option or "-toSrate" is required. The conversion factor is the amount by which the sampling rate is changed. If the sampling rate of the input signal is Srate1, then the sampling rate of the output is factor*Srate1. For example, a factor of 2.0 increases the sampling rate by a factor of 2, giving twice as many samples in the output signal as in the input. The fractional part of the conversion factor is accurate to 15 bits. This is sufficiently accurate that humans should not be able to hear any error whatsoever in the pitch of resampled sounds.

-filterFile
Change the resampling filter from its default. Such a filter file can be designed by the windowfilter (1) program (included with the resample distribution). The preloaded filter file requires an oversampling factor of at least 20% to avoid aliasing (in other words, its "transition band" as a lowpass filter is at least 20% of the useable frequency range in the sampled signal); the stop-band attenuation is approximately 80 dB.

-noFilterInterp
By default, the resampling filter table is linearly interpolated to provide high audio quality at arbitrary sampling-rate conversion factors. This option turns off filter interpolation, thus cutting the number of multiply-adds in half in the inner loop (for most conversion factors).

-linearInterpolation
Select plain linear interpolation for resampling (which means resampling filter table is not used at all). This option is very fast, but the output quality is poor unless the signal is already heavily oversampled. Do not confuse linear interpolation of the signal with linear interpolation of the resampling-filter-table which is controlled by the "noFilterInterp" option.

-terse
Disable informational printout.

-version
Print program version.

EXAMPLE

To convert the sampling rate from 48 kHz (used by DAT machines) to 44.1 kHz (the standard sampling rate for Compact Discs), the command line would look something like

        resample -to 44100 dat.snd cd.snd
or         resample -by 0.91875 dat.snd cd.snd

Any reasonable sampling rate can be converted to any other. (Note that, in this example, if you have obtained a direct-digital transfer from DAT or CD, you probably have some pre-emphasis filtering which should be canceled using a digital filter. See README.deemph in the resample release for further information)

REFERENCES

Source code and further documentation may be found at the Digital Audio Resampling Home Page (DARHP) located at

        http://ccrma.stanford.edu/~jos/resample/

HISTORY

The first version of this software was written by Julius O. Smith III <jos /at/ ccrma /dot/ stanford /dot/ edu> at CCRMA <http://ccrma.stanford.edu> in 1981. It was called SRCONV and was written in SAIL for PDP-10 compatible machines (see the DARHP for that code). The algorithm was first published in

Smith, Julius O. and Phil Gossett. ``A Flexible Sampling-Rate Conversion Method,'' Proceedings (2): 19.4.1-19.4.4, IEEE Conference on Acoustics, Speech, and Signal Processing, San Diego, March 1984.

An expanded tutorial based on this paper is available at the DARHP.

Circa 1988, the SRCONV program was translated from SAIL to C by Christopher Lee Fraley working with Roger Dannenberg at CMU.

Since then, the C version has been maintained by jos.

Sndlib support was added 6/99 by John Gibson <[email protected]>.

The resample program is free software distributed in accordance with the Lesser GNU Public License (LGPL). There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.