[LAU] Audio File to Graphic Thumbnail in Command Line?

Kevin Cosgrove kevinc at cosgroves.us
Tue Sep 2 23:12:29 UTC 2014


I dug into this a bit more.

Getting the time & amplitude data out of the WAV file was easy with

  sox file.wav -t dat - | tail -n +3 > file.dat

My beloved xgraph is not available on Fedora anymore.  That made me 
relearn gnuplot, a good move regardless.  I wrote a script to build
a gnuplot input file, file.gpl, which contains something like

  set terminal png notransparent nocrop
  set output file.png
  plot [] [-1:1] "file.dat" with lines

Then I run gnuplot on its input file like so

  gnuplot file.gpl > file.png

I left out a lot of housekeeping related to my scripting.  But, the
above does all of the work needed to produce a nice graph of my audio 
files.

Of course, this isn't fast.  It takes about 4 minutes on my
3.4GHz i7 with 16GB of RAM to create a plot from a 0.5GB mono WAV
file.  Audacity and Ardour are faster than sox + gnuplot at creating
their waveform views.  But, I can script with sox + gnuplot.

I hope this is useful for someone trolling the archive someday.

Cheerio...

--
Kevin




More information about the Linux-audio-user mailing list