10

Most of the audio editors are able to show us different kinds of audio analysis like this:

enter image description here

  • Wave form (whole file);
  • spectral frequency (whole file);
  • spectrum analysis (for a slice).

The generated images can be saved one way or another.

Is there a command line alternative to do this?

Windows 7. A multi-OS solution is preferred.

6 Answers 6

17

One of three tasks could be performed with SoX:

sox file.wav -n spectrogram
1
  • 1
    I ended up using for %w in (*.wav) do ("p:\sox-14-4-2\sox.exe" "%w" -n spectrogram -o "%~nw.png" -r -m -y 130) - (where the sox.exe is obviously pointing at the right one)
    – twobob
    Jul 22, 2016 at 2:12
13

You can use ffmpeg to create spectrogram

ffmpeg -i inputfile.mp3 -lavfi showspectrumpic=s=800x400:mode=separate spectrogram.png

Filter documentation: https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic

1
  • 1
    This doesn't appear to work for me (No such filter), and I can't see it as an obvious package... any hints?
    – Attie
    Oct 25, 2019 at 8:08
1

Since I couldn't find any windows examples, I've created a batch file you might find useful for automating all flac audio files in a directory, or which ever extension you choose to run, and creating a spectrogram for it (just change the (".*.flac") to (".*.extension") if you want them for different audio files) here:

FOR %%F IN (".\*.flac") DO sox.exe "%%F" -n spectrogram -p 2 -S 5 -y 240 -c "%%~NXF" -o "%%~NF.png"

Create a text file and put that code in it and save it as filename.bat, then run it with the files you choose in the sox directory, unless specified in another place. You can modify the colors as you see fit with -p 1 to 6.

0

I've just released specky which can do this for you as well.

pip install specky
specky-show my.mp3
0

For #3, Amplitude-Frequency plots, also called Bode plots,

  • the libre software Audacity produces these under the name "Plot Spectrum..."
  • a github project called WaveSpecter aims to tackle this from the command line.
-1

Imagemagick would be the solution, but the screen capture does not seem to work in Windows (it's looking for an X server).

Refer to the answers to this similar question here for other options.

1
  • I'm not about screen capture. Jun 22, 2011 at 8:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .