Thanks for the advice on the other fronts, i.e. Matlab for gaining a better understanding of FFT and DSP.>To answer your question directly, if you're looking to add "filter >effects" to a WAV file, then I will assume you mean running the audio >signal through a linear filter. To do this, you can read in the file >(Google for the WAV format header) and get the raw samples into an >array.I've done this.>You then need to convolve the time-domain signal with the >impulse response of your filter.Ok, this is the part I where I start to not understand what to do. Say I want to bump up all the frequencies in the samples by some arbitrary amount, say double it, so that the whole sound goes up an octave. 1) How do I come up with such a filter? How do I take a filter and convolve it using FFT? My understanding was that FFT would break the constituent frequencies of a sample out, not that I would apply some transformation at the point of the FFT. Because, then I planned to do an iFFT to translate the frequencies back into WAV form.> To avoid having to do really long FFTs (which >you would have to do if you took a single FFT of an entire audio >signal), fast convolution is typically done on a block-oriented basis, >with a reasonable FFT size of 1024, 8192, etc. based upon the >processing/memory you have available.So when you say block oriented does that mean, I take blocks of the audio sample and do the FFT on it? When I do the FFT with a block size of 8192, is that basically a second sample if the sample is 8000 Hz? Does anyone have sample fftw usage which describe scenarios like this? Thanks, Ben

# Using FFTW to do analysis of a WAV file

Started by ●January 24, 2008

Reply by ●January 24, 20082008-01-24

>Does anyone have sample fftw usage which describe scenarios like this?I do... you can run the code in "Octave" (GPL). http://www.elisanet.fi/mnentwig/webroot/FFT_filter_example/index.html

Reply by ●January 24, 20082008-01-24

On Jan 24, 2:26 am, "motleyruse" <motleyr...@yahoo.com> wrote:> Say I want to bump up all the frequencies in the samples by some arbitrary > amount, say double it, so that the whole sound goes up an octave. 1) How > do I come up with such a filter? How do I take a filter and convolve it > using FFT? My understanding was that FFT would break the constituent > frequencies of a sample out, not that I would apply some transformation at > the point of the FFT. Because, then I planned to do an iFFT to translate > the frequencies back into WAV form. >That's not possible with a linear filter. Pitch shifting is a rather complex topic and probably isn't something that you want to tackle if you're new to DSP. You're best off looking for texts with introductions to digital filtering and systems, like: http://ccrma.stanford.edu/~jos/filters/ http://www.dspguide.com Jason

Reply by ●January 24, 20082008-01-24

On Jan 23, 11:26 pm, "motleyruse" <motleyr...@yahoo.com> wrote:> My understanding was that FFT would break the constituent > frequencies of a sample outThis is usually not true. An FFT will break out a set of orthogonal frequencies which are exactly periodic in the FFT aperture. Except in special cases (e.g. the window is synchronized to a periodic source) these frequencies that an FFT breaks out are likely not the constituent frequencies of your sample set. They might be close, but there are weird effects (window artifacts and such) from being close and not precisely bin centered. Also, any modulation of the frequencies in your sample set will show up as (maybe a whole bunch of) additional frequencies from an FFT. Maybe, or maybe not, what you expect. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M

Reply by ●January 25, 20082008-01-25

Ron N. wrote: (snip)> This is usually not true. An FFT will break out a set of > orthogonal frequencies which are exactly periodic in the > FFT aperture. Except in special cases (e.g. the window > is synchronized to a periodic source) these frequencies > that an FFT breaks out are likely not the constituent > frequencies of your sample set. They might be close, > but there are weird effects (window artifacts and such) > from being close and not precisely bin centered. Also, > any modulation of the frequencies in your sample set will > show up as (maybe a whole bunch of) additional frequencies > from an FFT. Maybe, or maybe not, what you expect.Say, for example, one gets a WAV file off a CD that is about 14 minutes long. That is 12*60*44100 or 31752000 samples. Zero pad to 33554432 samples and FFT. Computers should be big enough now to do that fairly easily. Then look in the bins around 50Hz, which are very closely spaced with so many points. If there is a peak there you might smooth it so that it isn't too different from the nearby points, but not completely to zero. -- glen

Reply by ●January 25, 20082008-01-25

On Jan 25, 2:05 pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:> Say, for example, one gets a WAV file off a CD that is > about 14 minutes long. That is 12*60*44100 or 31752000 > samples. Zero pad to 33554432 samples and FFT.Why should you zero pad? 31752000 is highly composite already; its largest prime factor is 7. FFTW on my machine transforms size 31752000 significantly faster than size 33554432. Steven