Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Comparing Two Audio Files

by Zaxo (Archbishop)
on Jun 12, 2007 at 00:33 UTC ( [id://620599]=note: print w/replies, xml ) Need Help??


in reply to Comparing Two Audio Files

There is a mathematical technique called convolution which represents the similarity of two signals. In some contexts, it's called the correlation function. It's fairly easy to calculate with perl tools.

PDL is ideal for this. Take the FFT (Fast Fourier Transform) of each set of audio data. Multiply the transformed datasets term by term. Take the inverse FFT of the product dataset and you have the correlation function.

If the two signals are pretty much identical, the correlation function should approximate a delta function, having a strong spike at zero and vanishing elsewhere. For real world data, some scaling, filtering, and normalization might be desirable.

For this to work, the audio data should be raw signed numbers. You will likely need to decode to that for most popular audio formats. PDL::Audio may be of help.

After Compline,
Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://620599]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-19 10:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found