Comparison of two waveforms of audio files

2020-02-12 11:37发布

问题:

I am a VC++ developer and currently need help in comparing two audio files. Lets say I have two wave files and one of it is created using the other with some modifications like lowering the loudness etc.

Now, I have to compare these files and see if the modified one is almost copy of the original one, means, while creating the modified one, my application has unknowingly not distorted the file.

A percentage value would be better to signify how much different these files are. I have tried taking FFT of both files and then computing the difference in dB (like, 10 * log10 (ft1/ft2)) and averaging out the result. i get a resultant number but I am not sure what that number signifies.

Thanks in advance for any kind of help.

回答1:

The number you obtain doesn't really signify anything aside from how similar the spectra are. There are so many ways of modifying an audio file and so many ways of comparing them that it's impossible to give a general answer. If you know exactly which modifications are made then you can do a reasonable job. For instance if you know that the only modification is that the volume has been changed by a constant factor then if you take the squared magnitude of the FFT and normalise it (ie rescale so that the peak is 1.0) then this will be identical for the original and modified signals. You can calculate the sum of the differences of the two FFT magnitudes, but this is just a number and you can't convert it to a percentage in any meaningful way (what does it mean if I say two sounds are 30% different?)

So I would step back a bit and work out the problem that you're actually trying to solve.