spectro is a bash script which provides BBCode formatted text with the spectrograms of audio files (Ogg, MP3, FLAC, AAC, ape, WMA, MP4 or WAV).
To process an entire directory: spectro Path/To/Directory/
Or to process specific files: spectro <file1> <file2> ...
The output will look like:
[hide=Spectrograms][size=3]
[url=https://i.imgur.com/ClzzbP8.png]01. Jardin Du Sommeil.flac[/url]
[url=https://i.imgur.com/YPFZA1A.png]02. Chant D'Amour.flac[/url]
[url=https://i.imgur.com/sqdQfMd.png]03. Sur La Nuit Grandissante.flac[/url]
[/size][/hide]
- Place
spectrosomewhere in your PATH, like~/bin - Make it executable:
chmod +x spectro
Optional:
- Set up the first lines of the script (where the configuration is stored) to your liking.
To run spectro you will need:
soxwhich creates the spectrograms (with MP3 support if you want to usespectrowith such files): http://sox.sourceforge.netcurlto upload the images to imgur (not necessary if only used locally).
Optional dependencies:
ffmpegoravconvto process ape, WMA, MP4 and AAC files: https://ffmpeg.org/download.html or https://libav.org/download/ImageMagickto use the --compare feature (theconverttool from the suite is needed to create the .gif): http://imagemagick.org/script/binary-releases.phpoptipngto optimise the spectrograms. Necessary more often than not to avoid imgur transcoding the images to.jpg: http://optipng.sourceforge.netshasumto include the file SHA on the output BBCode output as well assox's spectrogram title.
You can configure the following options for spectro by modifying the first lines on the script using your favourite text editor:
api_keyImgur API key. Default value is thespectropublic API key. You can change it to use your own (if it ever hits the limits, for example) - you can read about it and register one here: https://api.imgur.com/oauth2.check_shaAdds the SHA of the file to the BBCode output as well as the title in thesoxspectrogram (Default is 0).local_directoryLocal directory where files will be stored (e.g. your public_html folder).offlineCreate local spectrograms (saved inlocal_directory), don't upload to imgur (Default is 0).optipngUse optipng on the spectrogram images to save space and avoid imgur compressing them to jpg (Default is 1).text_onlyOutput [url][/url] tags with the filename as the clickable link to the spectrogram (Default is 1). The alternative is to output [img][/img] tags to embed the images.url_formatURL that directs to the directory set inlocal_directory.
-c, --compare Create a .gif with the spectrograms of each file (e.g. spectro --compare <file1> <file2> <file3> ...)
-d, --double Take both zoomed in and full spectrogram for each file
-h, --help Show the help output
-l, --local Reverse the setting to output the spectrograms locally
-o, --optipng Reverse the optipng option set in the script
-p, --parallel Play nicely with parallel (won't ouput the [hide] or [size] tags)
-q, --quiet Don't show 'Uploading' text (necessary if you want to pipe)
-s, --sha Reverse the check_sha option (to show SHA value)
-t, --text Reverse the setting to use [url] tags or [img]
-z, --zoom Create only zoomed in screenshot (3 seconds)