1 ////////////////////////////////////////////////////////////////////////////////
3 /// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
4 /// while maintaining the original pitch by using a time domain WSOLA-like method
5 /// with several performance-increasing tweaks.
7 /// Anti-alias filter is used to prevent folding of high frequencies when
8 /// transposing the sample rate with interpolation.
10 /// Author : Copyright (c) Olli Parviainen
11 /// Author e-mail : oparviai @ iki.fi
12 /// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
14 ////////////////////////////////////////////////////////////////////////////////
16 // Last changed : $Date$
17 // File revision : $Revision$
21 ////////////////////////////////////////////////////////////////////////////////
25 // SoundTouch audio processing library
26 // Copyright (c) Olli Parviainen
28 // This library is free software; you can redistribute it and/or
29 // modify it under the terms of the GNU Lesser General Public
30 // License as published by the Free Software Foundation; either
31 // version 2.1 of the License, or (at your option) any later version.
33 // This library is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 // Lesser General Public License for more details.
38 // You should have received a copy of the GNU Lesser General Public
39 // License along with this library; if not, write to the Free Software
40 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
42 ////////////////////////////////////////////////////////////////////////////////
55 class FIRFilter *pFIR;
57 /// Low-pass filter cut-off frequency, negative = invalid
60 /// num of filter taps
63 /// Calculate the FIR coefficients realizing the given cutoff-frequency
64 void calculateCoeffs();
66 AAFilter(uint length);
70 /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling
71 /// frequency (nyquist frequency = 0.5). The filter will cut off the
72 /// frequencies than that.
73 void setCutoffFreq(double newCutoffFreq);
75 /// Sets number of FIR filter taps, i.e. ~filter complexity
76 void setLength(uint newLength);
78 uint getLength() const;
80 /// Applies the filter to the given sequence of samples.
81 /// Note : The amount of outputted samples is by value of 'filter length'
82 /// smaller than the amount of input samples.
83 uint evaluate(SAMPLETYPE *dest,
84 const SAMPLETYPE *src,
86 uint numChannels) const;