Skip to content

Instantly share code, notes, and snippets.

Last active May 25, 2024 06:04
Show Gist options
  • Save 0xdevalias/91ae33e0c9290e69b457ce5034956fb7 to your computer and use it in GitHub Desktop.
Save 0xdevalias/91ae33e0c9290e69b457ce5034956fb7 to your computer and use it in GitHub Desktop.
Some notes on comparing/contrasting/diffing audio files

Compare/Diff Audio Files

Some notes on comparing/contrasting/diffing audio files.

Table of Contents


    • When no specific feature is to be observed in sound, the best way to represent it is to display its spectrogram since it reflects what the ear does: measuring energy among frequencies as its varies with time.

      You can get that representation using the free and open source command-line tool SoX:

      sox sound-original.wav -n spectrogram -o sound-original.png
      sox sound-altered.wav -n spectrogram -o sound-altered.png

      In the case of more subtle alterations, it could be difficulty to see them.

      In such a case, computing the difference between the two signals and displaying its spectrogram would be appropriate:

      sox -m -v 1 sound-original.wav -v -1 sound-altered.wav sound-difference.wav
      sox sound-difference.wav -n spectrogram -o sound-difference.png

      Alternatively, creating the spectrogram directly without writing a temporary file:

      sox -m -v 1 sound-original.wav -v -1 sound-altered.wav -n spectrogram -o sound-difference.png

      In the command above, -m asks SoX to mix audio files together, and -v is intended to change the volume by a linear factor.

      In our case, the volume of sound-original.wav is left unchanged, whereas the -1 factor applied to sound-altered.wav is used to invert it.

      The whole command computes the difference between the two audio signals.

    • Sonic Lineup is a very nice interactive GUI tool for comparing two (or more!) audio files. It's open-source, cross-platform (Windows/Linux/Mac), written in C++ and Qt, and it automatically aligns each audio section. Then, you can start playing and switch between each audio file at any time.

        • Comparative visualisation of related audio recordings

        • Sonic Lineup is a free, open-source application for Windows, Linux, and Mac, designed for rapid visualisation of multiple audio files containing versions of the same source material.

          It's useful for comparing different recordings of the same performance; recordings of different performances of the same work; different "takes" of parts in a recording session or mix; or even recordings of variant works or cover songs, so long as they are structurally similar to one another.

          Sonic Lineup is not designed for editing, annotation, precision measurement, or any custom analysis of audio. In fact you might use it for only a few minutes at a time, as an assistance to listening, or an accessory to annotation done elsewhere.

    • Lossless Audio Checker A utility to check whether a WAVE or FLAC file is truly lossless or not.

    • Internet music dealers currently sell "CD-Quality" tracks, or even better ("Studio-Master"), thanks to lossless audio coding formats (FLAC, ALAC). However, a lossless format does not guarantee that the audio content is what it seems to be. The audio signal may have been upscaled (increasing the resolution), upsampled (increasing the sampling rate) or even transcoded from a lossy to a lossless format. Lossless Audio Checker analyzes lossless audio tracks and detects upscaling, upsampling and transcoding.

      • Lossless Audio Checker detects upscaling, upsampling and transcoding in lossless musical tracks.

    • FakeFLac (Lossless audio checker) Python GUI app used to spot fake lossless audio files through use of spectograms.

    • FLAD Fake Lossless Audio Detector

See Also

My Other Related Deepdive Gist's and Projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment