summaryrefslogtreecommitdiff
path: root/third_party/resample/man/resample.1
blob: 7a85565bc2de572ea75f94a3263639857f11beb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.TH RESAMPLE 1 "5 Jan 2006" "CCRMA"
.SH NAME
resample \- resample a 16-bit mono or stereo sound file by an arbitrary factor

.SH SYNOPSIS
\fBresample\fR 
[-by factor]
[-to newSrate]
[-f filterFile]
[-n]
[-l]
[-trace]
[-version]
inputFile
[outputFile]

.SH DESCRIPTION
The \fBresample\fR 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.

.SH OPTIONS

.IP \fB\-toSrate\fR
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.

.IP \fB\-byFactor\fR
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.

.IP \fB\-filterFile\fR
Change the resampling filter from its default.  Such a filter file can
be designed by the \fBwindowfilter (1)\fR program (included with the
\fBresample\fR 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.

.IP \fB\-noFilterInterp\fR
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).

.IP \fB\-linearInterpolation\fR
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.

.IP \fB\-terse\fR
Disable informational printout.

.IP \fB\-version\fR
Print program version.

.SH 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
\fBresample\fR release for further information)

.SH 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/

.SH 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 <jgg9c@virginia.edu>.

The \fBresample\fR 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.