Last active
November 29, 2022 20:43
-
-
Save hrywlms/5fca1ab19670363a2d43 to your computer and use it in GitHub Desktop.
A quick way to generate spectrograms for a bunch of audio files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Generate PNG spectrograms using SoX | |
### Use the input file name as the title within the image as well as the output file name | |
### Set the width to 2000 (seems to output a ~2140px wide image) | |
### Generate for FLAC | |
for file in *.flac;do | |
outfile="${file%.*}.png" | |
title_in_pic="${file%.*}" | |
sox "$file" -n spectrogram -t "$title_in_pic" -o "$outfile" -x 2000 | |
done | |
### Generate for MP3 | |
for file in *.mp3;do | |
outfile="${file%.*}.png" | |
title_in_pic="${file%.*}" | |
sox "$file" -n spectrogram -t "$title_in_pic" -o "$outfile" -x 2000 | |
done | |
### Generate for Ogg Vorbis | |
for file in *.ogg;do | |
outfile="${file%.*}.png" | |
title_in_pic="${file%.*}" | |
sox "$file" -n spectrogram -t "$title_in_pic" -o "$outfile" -x 2000 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment