halloleo
halloleo

Reputation: 10364

With the audio tool sox, how can I determine whether a stereo recording is in fact mono?

I have stereo files (2-channel-WAV) which sound totally like mono recordings. Is there a way to let sox run over the file and output whewther the 2 channels are the same or not?

Or is there another command line tool doing this sort of wave comparison aggregating the differences between the to channels of a sound file into a "similarity number"?

Upvotes: 4

Views: 2727

Answers (1)

chirlu
chirlu

Reputation: 3301

You can invert one channel and add it to the other one (thereby subtracting them), then check if the difference is zero:

$ sox input.wav -n remix 1,2i stats
DC offset   0.000000
Min level   0.000000
Max level   0.000000
Pk lev dB       -inf
RMS lev dB      -inf
...

If Pk lev dB shows as -inf, channels 1 and 2 are identical.

This may or may not give meaningful results for channels that are very similar but not identical. A simple phase shift, e.g., might lead to a large difference sample-wise, but still sound exactly the same.

Upvotes: 5

Related Questions