Generate Spectrogram with SoX

8.9k views Asked by At

I'm trying to generate a spectrogram using the SoX program. According to the documentation, I should try the following to create a spectrogram:

sox output.wav -n spectrogram

Instead of a spectrogram I get the following error:

sox FAIL formats: can't determine type of `spectrogram'

I'm running Ubuntu 12.04.

4

There are 4 answers

0
Raphael Adamski On

I had this issue when i built SoX on my own. The lack of libpng created a binary without spectrogram effect. In other words, your command is trying to open a file named "spectrogram". Run

sox -h

and check the if you have this effect.

0
Dima Melnik On

I know why it happened. You copied this text-command from documentation http://sox.sourceforge.net/sox.html So, if you type manually it will work fine. Some symbols in documentation are in incorrect charset for you

0
tripulse On

This is how to do it,

sox output.wav -n spectrogram
0
scruss On

To amplify Dima Melnik's answer, the online manual has substituted Unicode characters where ASCII is expected. If you copy the spectrogram example verbatim, the -n (bytes \x2d \x6e) you think you're typing are actually −n (bytes \xe2 \x88 \x92 \x6e, first character U+2212 MINUS SIGN in UTF-8). sox is trying to parse−n as a file name, and is getting confused.