I’m building a domain-specific language called Arpeggio that compiles1 code into songs. When an Arpeggio program is run, the compiler will need a way to turn parsed instructions (e.g. play a C major chord for 1/4 of a measure) into playable audio. This post goes over the process of designing and building that backend API. Building a Song in Code In Part 2, I outlined how we can represent musical concepts like keys, modes, notes, and chords in Python.