Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

(jcwren) Re: How to compare 2 wav files.

by jcwren (Prior)
on May 27, 2002 at 20:52 UTC ( #169642=note: print w/replies, xml ) Need Help??

in reply to How to compare 2 wav files.

This is a non-trivial task, although not impossible.

Basically, you'd need to run a sliding window FFT/DFT (Fast Fourier Transform/Discrete Fourier Transform) and look at the spectral energy density of various frequency groups. If the energy density is the same for both samples at the same time, you could consider them the same.

FFT/DFTs are not difficult to implement, and while I'd tend to do it in C, I think Perl should do it pretty well. There are dozens of FFT/DFT implementations on the 'net. Decoding the .WAV format is pretty simple, also.

About the only problem I can really see is that if you have two .WAV files sampled at different rates (i.e., one is 44.1Khz, and the other 10Khz). In that case, you'd have to resample one to match the other. Still not overly difficult, but an added step.

Welcome to DSP-101


e-mail jcwren

  • Comment on (jcwren) Re: How to compare 2 wav files.

Replies are listed 'Best First'.
Re^2: How to compare 2 wav files.
by bitingduck (Chaplain) on Mar 15, 2015 at 09:11 UTC
    UPDATE: late at night and didn't check the date to see that it was a zombie thread... post is still relevant in case someone looks...

    FFT/DFTs are not difficult to implement, and while I'd tend to do it in C, I think Perl should do it pretty well.

    It's not difficult, but I wouldn't bother implementing FFTs myself at all anymore, except as an excercise in implementing FFTs or if I needed to own the code. There are free libraries available, such as fftw that are already debugged, documented, and reasonably optimized. Fftw is pretty speedy - about 0.06 seconds to do a 2048x2048 2D-FFT on a new-ish (i7) Macbook.

Re^2: How to compare 2 wav files.
by mahfuzt786 (Initiate) on Sep 06, 2012 at 17:21 UTC
    when and where to use FFT..??

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://169642]
[GotToBTru]: I
[GotToBTru]: ve been looking at a document we have been sending to a customer for years now
[MidLifeXis]: We don't, at least in this case ;-)
[GotToBTru]: and it includes a reference number that I didnt recognize
[GotToBTru]: I had to dig into the code to find out where it came from .. and it makes no sense
[GotToBTru]: so I emailed my contact asking if we could just stop sending it .. I'm afraid she is going to ask "what is that anyway?"
[MidLifeXis]: heh.
[MidLifeXis]: Most likely it is a code that some undocumented system, hidden behind layers of IT, deep in the bowels of the building under the machine room floor, reads that code to keep a presence switch from going off. :-b

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2017-01-20 19:04 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (176 votes). Check out past polls.