#!/bin/bash
ffmpeg -i "$@" /dev/shm/spectrogram.wav < /dev/null
sox /dev/shm/spectrogram.wav -c 1 -t sox - gain -n -B |
sox -V -t sox - -n spectrogram -x 1820 -y 1025
rm /dev/shm/spectrogram.wav
mv spectrogram.png "$@.png"

# usage
# find -mindepth 1 -maxdepth 1 -name \*.mp3 -exec ~/bin/spekk.sh {} \;
