The Public Radio station, WNYC, released a really nice audiogram generates. Audiograms are those short videos that are created for an audio clip, that show a waveform. Video is easy to share on a lot of social platforms and turning the audio into a video also makes it a little more engaging.
WNYC’s tool is open source, but it hasn’t been updated since 2016 and there is a bit of bit-rot. I first tried to install it on my MacBook… but that was a dismal failure. I was able to get it working on my Linux box, which is using Ubuntu 18.04. Here are the steps I took:
The full instructions are here.
sudo apt-get install git nodejs npm \ libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev libpng-dev build-essential g++ \ ffmpeg \ --yes git clone https://github.com/nypublicradio/audiogram.git cd audiogram
Now you have all the dependencies, and the source code. The first bug you hit is that the package.json specifies an old version of node-canvas.
Run npm install – it will fail!
Now, install the latest version of node-canvas:
npm install canvas@next
Unfortunately, you will hit another bug when you try to run things. Luckily, someone has a fix. Open audiogram/draw-frames.js and edit line 12.
Change:canvases.push(new Canvas(options.width, options.height));
tocanvases.push(new Canvas.createCanvas(options.width, options.height));
Now you should be good to go! Start it up with: npm start