4

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
  • 53,069
  • 19
  • 162
  • 212
user198350
  • 3,769
  • 15
  • 50
  • 89
  • 5
    by "mono", it's quite possible that this means the same signal is mixed to both left and right channels. This might be done in order to ensure that both left and right speakers get signal – Blaine Jun 12 '17 at 12:10
  • 1
    @Blaine's comment kind of suggests that this question might be impossible to solve as you'll never be able to identify whether the original was recorded in mono, stereo or whether the "mix" was one channel of an originally stereo-recorded song... – Kinnectus Jun 12 '17 at 12:16
  • 2
    Not saying i know of a way to do it, but a potential solution would be to somehow compare the right channel and left and check if they are identical or not – Blaine Jun 12 '17 at 12:21
  • @Kinnectus: It doesn't matter in what format the original album was recorded, that is outside the scope of this question. But as explained in Blaine's comment, I now understand that potentially "the same signal is mixed to both left and right channels" - therefore technically stereo, but practically mono. – user198350 Jun 12 '17 at 12:22
  • @Blaine: I'm considering asking about comparing channels in Audacity as a follow-up question. – user198350 Jun 12 '17 at 12:23
  • Does Audacity have a function of subtracting one channel from another? If (left - right) != 0, it's a stereo recording. (Although not necessarily _originally_ recorded as stereo, in the era of algorithms...) – u1686_grawity Jun 12 '17 at 12:25
  • 1
    @grawity: https://superuser.com/questions/1218450/how-to-compare-audio-channels-in-audacity – user198350 Jun 12 '17 at 12:38
  • Please do not double post: https://superuser.com/questions/1218450/how-to-compare-audio-channels-in-audacity – Xavierjazz Jun 12 '17 at 12:57
  • @Xavierjazz: It is a different question. This one has been resolved. – user198350 Jun 12 '17 at 13:01
  • [How do I check if a 2-track WAV file is "really" in stereo?](https://superuser.com/q/1635775/432690) – Kamil Maciorowski Jan 20 '23 at 20:19

3 Answers3

6

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,700
  • 1
  • 18
  • 27
  • Audacity can't open the output file, "file could not be found error": https://i.imgur.com/hKnYnaI.png – user198350 Jun 12 '17 at 13:09
  • 1
    you have to use a "proper" path (meaning: one that your account can read/write to), for example C:\Users\\Desktop\testfile.wav – flolilo Jun 12 '17 at 13:12
  • Thank you, works now! This is how the file looks in Audacity, a flat waveform: https://i.imgur.com/mQkBtYz.png – user198350 Jun 12 '17 at 13:15
  • You're welcome. Two things: 1) I would suggest you use "waveform (dB)" for waveform representation: http://imgur.com/a/5WcRr 2) I would change the dB range to at least -72 in the settings: http://imgur.com/a/7WVxl . If you then still can't see (and, more importantly: hear) anything, then it most certainly is a stereo-file with the same mono-track on both channels. – flolilo Jun 12 '17 at 13:28
  • @flolilo I get the errror: `[AVFilterGraph @ 0074ea00] No such filter: 'stereotools' Error configuring filters. Conversion failed!` Any ideas? – KeyC0de Dec 05 '19 at 15:20
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
  • 19,950
  • 5
  • 51
  • 46
3

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
  • 131
  • 4