Is there (somewhere) a command-line program for Windows which will create PNG/JPEG visual from MP3/WAV?
EDIT: This is a good example of how the image should look like.
The Waveform Audio File Format (WAV) is an audio file format. It is considered a "first-generation" format with no compression except with some manipulations in order to store the sound digitally, resulting in larger sizes compared to formats like MP3 and WMA.
What is WAV? WAV (or WAVE) stands for Waveform Audio File Format. It was developed by IBM and Microsoft.
Windows and Mac are both capable of opening WAV files. For Windows, if you double-click a WAV file, it will open using Windows Media Player. For Mac, if you double-click a WAV, it will open using iTunes or Quicktime. If you're on a system without these programs installed, then consider third-party software.
In fact, Cloudinary is a superb waveform generator. Creating a waveform image for an audio file you’ve uploaded to your Cloudinary account takes only two steps: Change the file extension (format) of the audio’s delivery URL on Cloudinary to an image-centric format, such as PNG. Enable the waveform flag by adding fl_waveform to the URL.
Waveform images are a nice way to visualize audio files, and are useful for user generated content, social networks and social messaging apps. With Cloudinary you can easily generate images of the waveforms of audio files, with the images generated on-the-fly using dynamic delivery URLs and delivered optimized via a fast CDN.
In fact, Cloudinary is a superb waveform generator. Creating a waveform image for an audio file you’ve uploaded to your Cloudinary account takes only two steps: Change the file extension (format) of the audio’s delivery URL on Cloudinary to an image-centric format, such as PNG.
The waveform is blue on a green background with a duration between two-second mark and the four-second mark, scaled to a height of 250 pixels and a width of 400 pixels: As an appealing visual depiction of audio files, waveform images work well for user-generated content, social networks, and social-messaging apps.
Sox, "the Swiss Army knife of audio manipulation", can generate accurate PNG spectrograms from sound files. It plays pretty much anything, and binaries are available for Windows. At the most basic level, you'd use something like this:
sox my.wav -n spectrogram
If you want a spectrogram with no axes, titles, legends, and a light background that's 100px high:
sox "Me, London.mp3" -n spectrogram -Y 130 -l -r -o "Me, London.png"
Sox accepts a lot of options if you only want to analyze a single channel for example. If you need your visuals to be even cooler, you could post-process the resulting PNG.
Here is a short overview from the commandline about all available parameters, the manpage has more details:
-x num X-axis size in pixels; default derived or 800
-X num X-axis pixels/second; default derived or 100
-y num Y-axis size in pixels (per channel); slow if not 1 + 2^n
-Y num Y-height total (i.e. not per channel); default 550
-z num Z-axis range in dB; default 120
-Z num Z-axis maximum in dBFS; default 0
-q num Z-axis quantisation (0 - 249); default 249
-w name Window: Hann (default), Hamming, Bartlett, Rectangular, Kaiser
-W num Window adjust parameter (-10 - 10); applies only to Kaiser
-s Slack overlap of windows
-a Suppress axis lines
-r Raw spectrogram; no axes or legends
-l Light background
-m Monochrome
-h High colour
-p num Permute colours (1 - 6); default 1
-A Alternative, inferior, fixed colour-set (for compatibility only)
-t text Title text
-c text Comment text
-o text Output file name; default `spectrogram.png'
-d time Audio duration to fit to X-axis; e.g. 1:00, 48
-S time Start the spectrogram at the given time through the input
A real waveform is possible with ffmpeg, you can download it here.
Install it somewhere and use the following command line as example:
ffmpeg.exe -i "filename.mp3" -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
or the following to match your example picture color, or other colors:
ffmpeg.exe -i "filename.mp3" -lavfi showwavespic=s=1024x800:colors=0971CE waveform.png
Documentation of FFmpeg showwavespic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With