Waveform Generator  2017-11-29

screenshot of waveform generator application

I originally wanted to do this project because while I was in a figure drawing class in college, for my final project I played around with databending. My professor suggested I could also print out an image of the waveform of the digital painting as an audio file and hang it up along with the rest of my final project. I thought this was a good idea and set out to find a free program that would let me choose colors, that could handle an audio file that was very large and export an image that was very large and I came up empty handed. Fast forward a couple years and I finally got around to making it myself. This started as a webapp but I turned it into a simple Electron app because there's an upper limit on how large of a file you can trick kindly ask the browser to download by sending it a data uri, and this varies from browser to browser so there's no good way to account for this limitation.

This wasn't a very deep dive into Electron by any stretch, other than the filesystem access I didn't touch any of the features that makes Electron worth it. And I also got all of the downsides of using Electron, namely a large Chromium instance packaged with my, otherwise not very big, "webapp." At the same time, being able to use HTML and CSS for making a layout for a desktop app is honestly great. I absolutely love it. Despite that, towards the end I was doubting whether Javascript was even a very good choice for this application because the Javascript library I used to actually make the waveform, wavesurfer.js, uses the canvas to render the waveform(makes sense for a web library). The issue comes in because I wanted to use wavesurfer to generate a preview waveform to one canvas, but then to export the final image, of a possibly very large size, I had to create a second, hidden canvas, and use that canvas to export the final image. So that was kind of a sketchy workaround, but it works and meets all the requirements I had for the project, and I got to try out Electron a little bit, so all around I'd say it was a success.