in reply to Re^2: Compare wav files
in thread Compare wav files

I'm assuming you are tackling the slightly trickier problem of finding individual sound frequencies within the .wav file.

To do this you will have to unpack the time domain data in the .wav (which you can do using Audio::Wav::Read or unpack) and then perform a Fourier transform to get this data into the frequency domain (Math::FFT). I recommend reading up on DSP a bit to learn the theory.

You might also try Audio::Analyzer =)

Replies are listed 'Best First'.
Re^4: Compare wav files
by asha_mail (Novice) on Apr 18, 2012 at 05:54 UTC

    Suppose I have two .wav files having same sound but different pitch(one sound taken from near the mic and same sound from keeping the mic far away). So how can I identify at what second the sound has been produced?

    Will both the wav sound be having same sample rate?

      So what you actually want is to synchronize the two files? That is to find the delay of the one that starts later so that you could play them as stereo?

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

      It would seem that the OP has two .wav files recorded in a system like this:

      We have two identical audio sources triggered at the same time. Audio source 1 is a negligible distance from the recording mic. Audio source 2 is a distance x from the recording mic. We activate them both and record a .wav file.

      The OP notes that the more distant audio file has a different pitch, probably due to higher frequencies dropping off more quickly than lower ones over a distance.

      We really need to calculate the distance x then we can solve for the time using the speed of sound. If you know (or can figure out) the rate of frequency attenuation through your medium, that would work. I suspect there would be some amplitude attenuation that you could use as well which is a more common calculation for this problem.