5

Sometimes I have to verify using a reputable method if an audio track is recorded in mono or stereo, especially when researching older music albums.

I have a reason to believe that Audacity doesn't tell this when opening a file. For example, this 2009 mono remaster of “Please Please Me” by The Beatles is displayed as stereo.

Screenshot.

Giacomo1968
  • 58,727
user198350
  • 4,269

3 Answers3

7

One way to tell if a stereo-file has the same mono-track on both its channels is by phase-inverting one of the channels (for example, the left one) and then add it up with the other channel. (Therefore we're looking for the phase-coherence)

I don't use audacity very frequently, so I do not know if it is able to do such a thing, but here's a small FFmpeg-syntax that does what you want:

ffmpeg -i 'is_this_stereo.wav' -filter_complex "stereotools=phasel=1" -ac 1 'output.wav'

(Also works with other audio-codecs - outputting a lossless format like WAV ensures that the encoding doesn't delete anything)

What that FFmpeg-script does: It reverses the phase of the left channel, then sums up both channels in one new channel.

Instead of -ac 1, you could also alter the filter_complex-chain to stereotools=phasel=1[tmp];[tmp]pan=1c:c0=0.5*c0+0.5*c1. I don't think this is necessary, however.

If you then look at the newly created file, and you see a flat line in the waveform, then the left channel of the original file is exactly the same as the right one. If there are only very small peaks (say, around -60dB or less) then the difference probably is just caused by encoding artifacts - just listen to it to be sure.

Code sources:

flolilo
  • 2,831
5

I prefer to let computers do the dull work, so starting from flolilo's answer, I ended up with:

ffmpeg -i is_this_stereo.wav -filter_complex 'pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak:window=0' -f null -

This shows a warning "Output file is empty, nothing was encoded" if the input file's channels are exact replicas (which they are for at least one of my CDs). You could relax the silenceremove filter to ignore some noise, for instance silenceremove=start_periods=1:start_threshold=0.02 or start_threshold=-17dB, but that relative amplitude is relative to the PCM capability, not relative to the recording level. For some of my CDs, this value filters out subtle but quite audible stereo; for others, it's about the minimum.

The -f null - part simply suppresses file output, in case the console message is enough, but of course you can let it write the difference file. To check the mono-ness in a script, the best I come up with is:

out=$(ffmpeg -nostdin -loglevel error -i "$infile" -filter_complex 'pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak:window=0' -t 0.00002 -f crc -)
if [ "$out" == 'CRC=0x00000001' ]
then echo "$infile is definitely mono"
fi

In that script fragment:

  • Time limit -t 0.00002 cuts the difference emitted down to a single sample (for standard CD contents at 44,100 samples/second), which greatly speeds up the inspection of stereo files. -frames 1 results in the same, on my system, but I'm not sure it's supposed to because a frame contains more than one sample.
  • -f crc writes the output as something ASCII, which is way easier to handle in a script. If one 16 bit sample makes it through the silence remover, the 32 bit CRC has to change from its initial value of 1, I think. Could also use -f md5 or -f hash.
  • Assigning out separately, instead of invoking it inside the test expression, ensures that the script stops on error if you use the shell's -e option.
Stein
  • 151
3

As mentioned in the comments, there is a fundamental difference between a stereo file and a stereo recording.

Nothing stops us from creating a file, that has both stereo channels fed from a single audio source - this is e.g. Standard for old recordings remastered for CD.

The typical way to get an idea of whether a stereo file actually contains sterophonic content is to calculate the quadratic sum of the number of zero-passes per second on both channels. I do not know, if Audacity or other free software tools have this bilt-in.

Turns out, that the human eye is quite good in spotting channel differences, so if the number of recordings to check is low, a wave graph (as produced by audacity) should give you a good feel, whether this is stereophonic or not.

Eugen Rieck
  • 20,637