Previous Up Next

28.2.12  Visualizing waveforms

The plotwav command displays the waveform of an audio clip.

Examples

With the file gs-16b-2c-44100hz.wav downloaded from here (an excerpt from a piece of band music):

clip1:=readwav("/home/luka/Downloads/gs-16b-2c-44100hz.wav")
     
a sound clip with 698194 samples at 44100 Hz (16 bit, stereo)           
duration(clip1)
     
15.8320634921           

plotwav draws the waveform of each channel separately by going from top to bottom:

plotwav(clip1,range=0.5..12.5)

With the file gettysburg10.wav downloaded from here (a 10 seconds speech):

clip2:=normalize(readwav("/home/luka/Downloads/gettysburg10.wav"),-1):; plotwav(clip2,range=0.0..5.5)

You can choose different colors for the waveform, for example:

plotwav(clip2,range=0.0..5.5,color=[purple,magenta])

By setting the tstep option you can control the “resolution” at which the waveform is displayed. For example:

plotwav(clip2,range=0.0..5.5,tstep=0.1)

To “zoom-in” the waveform, use the range option rather than the mouse wheel:

plotwav(clip2,range=0.5..0.55)

Previous Up Next