Today I wrote a song with Strudel, a JavaScript DSL for making music. Here’s my first program, the introduction to the song “Zero” by the Smashing Pumpkins.

setcpm(60 / 4);

const lead = "59 58 51 51 51 51 51 59@2 58 58 51 51 51 51 51";

$: note(lead).sound("sawtooth").gain(0.5);

$: note(lead).transpose(-12).sound('sawtooth').gain(0.5);

$: note("~ ~ ~ 82 79 75 ~ ~ ~ ~ ~ 82 79 75@2 ~")
  .transpose(12)
  .sound('sawtooth')
  .gain(0.5);

$: s("bd ~ bd ~, ~ sd ~ sd, oh*4").fast(2).gain(0.6);

$: s("<cr ~>").fast(2).gain(0.6);

A couple of learnings: you can create an octave with transpose, ~ are rests, and you can make a distorted guitar with a sawtooth wave.

You can hear it here on Strudel (for now?).