Get the latest tech news

Synthesizing Music from JSON


l;dr: pl_synth is a tiny music synthesizer for C & JS and an editor (“tracker”) to create instruments and arrangements. You can try it out at phoboslab.org/synth/ Sonant is a brilliant piece of software.

The instrument is defined by a bunch of parameters, most importantly the waveform (Sine, Square, Sawtooth or Triangle) and the frequency of two independent oscillators. I squeezed out quite a bit more performance by restructuring some of the if statements, merging multiplications and just making sure that there's no division or function calls in the inner loop. Compressing the JS array format with CompressionStream and base64 encoding the result typically yields a string that is 300-1200 characters long (depending on the length and complexity of the song itself) – short enough to fit into a URL

Get the Android app

Or read this on Hacker News

Read more on:

Photo of music

music

Photo of json

json

Related news:

News photo

This tiny button pulls off the wall and controls your lights and music with gestures

News photo

OCRing Music from YouTube with Common Lisp

News photo

Matter speakers could stream music and tell you when the wash is done