Tutorial – graphing sound
1 Introduction
There are numerous tools out there to help you analyse, view and extract audio information from films. Dropping your .mkv file into REAPER for example will extract the audio, generate a waveform and give you full access to view and edit the 5.1 mix that’s there.
There are other tools too that will pay dividends if you spend a few minutes to work out how to use them. SoX is an old, yet still fantastic tool for processing audio, separating out stems and generating waveforms: sox.sourceforge.net/
FFMPEG is superb for extracting chucks of a larger film and keeping, or processing the video material in different ways to make the files useful in other forms. ffmpeg.org/
MPV is a very handy video playback tool that is built on FFMPEG and has innumerable options to playback parts or whole of video tracks or audio only etc.: mpv.io/
Finally, www.sonicvisualiser.org/, made at the Queen Mary, University of London gives you access to a huge range of visualisation options. Depending on which operating system you’re using, you may not have access to the latest version, grab an earlier one from this page: code.soundsoftware.ac.uk/projects/sonic-visualiser/files. For example, version 3.2 doesn’t work on OSX10.11.x but 3.1.1 does.
2 Workflow
First of all, you need to choose your section of film to explore, you can take the film and drag and drop it onto an empty REAPER session.
When you have selected a region of the film you want to explore, remove the other parts of the film and bounce/export the audio. If you have 5.1 mix, export as multichannel so that you can keep all of that lovely information.
If you want to export just that chunk of film, make a region and select a movie format for the kind of export you’re looking for.
If you’d like to use FFMPEG for this, and I do recommend it very highly for its speed and efficiency, then you could try this
ffmpeg -ss 01:10:30.0 -t 00:00:10.0 -i inputFile.mkv -map 0 -codec copy -async 1 inputFileSelection.mkv
-map 0 guarantees that all the tracks in the .mkv will be copied across so you can still select surround, or stereo audio on playback.
If you want to grab just the audio so you can run an analysis on the audio, then you’d do this
ffmpeg -ss 01:10:30.0 -t 00:00:10.0 -i inputFile.mkv -map 0:1 audioOnly.wav
The -map0:1 gives us the first audio track in the .mkv.
Once you have just the audio, you can render off a spectrogram with SoX:
sox inputFile.wav -r 5k -n rate spectrogram -t "title of track" -x 2599 -y 600 -z 120 -o "outputSpectrgram.png"