Created
April 15, 2016 08:31
-
-
Save stubbetje/0562f469d468c7b1d1f69e60aa06246d to your computer and use it in GitHub Desktop.
wave form from audio
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
#set output format and size | |
set term png size 320,180 | |
#set output file | |
set output "audio.png" | |
# set y range | |
set yr [-1:1] | |
# we want just the data | |
unset key | |
unset tics | |
unset border | |
set lmargin 0 | |
set rmargin 0 | |
set tmargin 0 | |
set bmargin 0 | |
# draw rectangle to change background color | |
set obj 1 rectangle behind from screen 0,0 to screen 1,1 | |
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "#222222" | |
# draw data with foreground color | |
plot "audio_only.dat" with lines lt rgb 'white' |
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
ffmpeg -i video.avi -vn -acodec copy output-audio.mp3 | |
sox output-audio.mp3 audio.dat #create plaintext file of amplitude values | |
tail -n+3 audio.dat > audio_only.dat #remove comments | |
# write script file for gnuplot | |
echo set term png size 320,180 > audio.gpi #set output format | |
echo set output \"audio.png\" >> audio.gpi #set output file | |
echo plot \"audio_only.dat\" with lines >> audio.gpi #plot data | |
gnuplot audio.gpi #run script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment