Diffing audio - help me figure out what's going on?
Posted: Sat Mar 14, 2015 7:38 pm
I have one audio file, in "raw" signed 16-bit PCM format.
I also have a program that outputs raw signed 16-bit PCM data. I want to compare the output of the program to the content of the first file.
The files are different if we simply look at raw bytes (checked with Beyond Compare).
When I import the two tracks into Audacity, the waveforms appear the same. I can't hear any difference when playing them. I tried to use Audacity to compute the difference. To do that, I inverted one of the tracks and then mixed the two tracks together and rendered it into a separate track. It produced a flat line, which probably means that the inverted track and the other track cancel each other out, and therefore, the tracks are equivalent. However, when I exported the "silence" to a raw file and opened it in a hex editor I was surprised to see that it contained bytes with different values (I would expect all the bytes to have the same value, since the "diff" track appeared to be completely silent).
Can someone explain to me what's going on here? Why do two different PCM chunks produce results that are indistinguishable? Is comparing raw bytes even a valid approach for testing the "equivalence" of sound data? And what should I do if I want to compare two raw PCM streams programmatically, without Audacity?
I also have a program that outputs raw signed 16-bit PCM data. I want to compare the output of the program to the content of the first file.
The files are different if we simply look at raw bytes (checked with Beyond Compare).
When I import the two tracks into Audacity, the waveforms appear the same. I can't hear any difference when playing them. I tried to use Audacity to compute the difference. To do that, I inverted one of the tracks and then mixed the two tracks together and rendered it into a separate track. It produced a flat line, which probably means that the inverted track and the other track cancel each other out, and therefore, the tracks are equivalent. However, when I exported the "silence" to a raw file and opened it in a hex editor I was surprised to see that it contained bytes with different values (I would expect all the bytes to have the same value, since the "diff" track appeared to be completely silent).
Can someone explain to me what's going on here? Why do two different PCM chunks produce results that are indistinguishable? Is comparing raw bytes even a valid approach for testing the "equivalence" of sound data? And what should I do if I want to compare two raw PCM streams programmatically, without Audacity?