Sound Viewer Tool – a fast Python script to get waveform and spectrogram from a sound

This entry was posted in Bioacoustics, Python. Bookmark the permalink.
  • Carlo DiCelico

    This is a beautiful bit of code. I have two questions, though. Say I wanted to allow the user to input a color or colors for both the spectrograph and waveform, what would be the best way to modify the script to accomplish that? Also, could this be altered to output an SVG instead of a PNG or JPG?

    Well done and thanks for your awesome work.

  • ljvillanueva

    To change the colors, just change the RGB values in the lists for each corresponding image. For the waveform is in the WaveformImage class and for the spectrogram in the SpectrogramImage class. This script uses PIL, so it can only export an image in a format that is supported by it, so only rasters. I guess you would need to add a library that can export to SVG or convert the image.