10

I have two audio files in wav format, one of them has some noise because I have modified some bits inside the file. I can just play those files using audio player and other people could hear the difference. But I must also represent it using graphics to show them that two files are not same.

What technique/method do I need to achieve that? And is there any free/cheap software to do that?

4 Answers 4

12

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

spectrogram of the original sound spectrogram of the altered sound

The alterations in the second sound can clearly be seen on its spectrogram which is good.

But 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

spectrogram of the difference between the two sounds

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.

5
  • 1
    Thanks learned alot. If I understand correctly the files are both compared at the same positions, but in my specific case the sound files are different because they are time shifted. Is there a way to see or calculate the overlap between them? This is because I extract the audio from TV recordings which are potential the same recording but both can be started at slightly different time before the real TV program starts because of delay in the TV programming.
    – Jan
    Jun 1, 2019 at 14:50
  • 1
    Maybe this topic will bring you some answers about the time shift problem. But in your case it may be more complicated than that as many parameters may vary. Jun 3, 2019 at 10:43
  • For anyone passing by, I adapted this into a handy script :) thanks @maxime.bochon git.jfischer.org/xeruf/dotfiles/src/branch/main/.local/bin/…
    – xeruf
    Nov 17, 2021 at 14:57
  • @xeruf do you still have that script anywhere? Would love to see it, as the link you posted above is no longer accessible. Nov 22 at 21:14
4

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.

Look at this screenshot! We can clearly see that this section was longer (8 seconds longer) in the second file. Given these are 26-minute long files, it would be very hard to find this difference otherwise.

Sonic Lineup screenshot

1

Any DAW will create a valid visual representation of any given waveform. You can search for a free one. I can hardly understand the reason though..

5
  • If the goal is to highlight the difference between the two files, it might be worth displaying the waveform of the difference between the two files.
    – audionuma
    Nov 5, 2016 at 5:51
  • Sound has been around way before daws, i mean unless he turns a sine to a saw which a palmograph can cover, i dont see why you have to visualize an audible difference. In not aiming @ the op here anyways :)
    – frcake
    Nov 5, 2016 at 13:09
  • Frcake, Palmograph?
    – n00dles
    Nov 5, 2016 at 15:38
  • Oscilloscope sorry :)
    – frcake
    Nov 5, 2016 at 16:56
  • You had me googling palmograph lol.
    – n00dles
    Nov 6, 2016 at 14:05
1

It depends on what changes you have made really, what kind of analysis would show the difference depends on this.

If you just want simple waveform displays then Audacity is the go-to open source multitrack recorder/editor.

If you want a more thourough and detailed screenshot, something like iZotope Insight (VST) would probably be my choice. You can feed the two separate channels into it and overlay them in a 3D spectrogram for example. enter image description here

I think the trial version should allow you to do this if you just want to get a screenshot.

Also, you could subtract one file from the other to get a waveform (or other) display of just the difference if you wish to.

There are many ways to display the two files to show the difference, as I said at the start, it depends on what you need people to see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.