CyberSpy

Rantings from a guy with way too much free time

Experimenting with Programatically-Generated (Sheet) Music

2017-10-16 Musings

Music Math Mashup - A Multi-part Series on Music, Math, and Programming

Today, I thought I’d experiment with smashing music and software together - let’s take a look at different algorithms and tools that allows us to experiment with the generation of music, along with the visualization, and performance of our generated scores. There’s a lot here, and we’re going to tackle it in multiple blog posts, so don’t get overwhelmed thinking about all of it at once!

STEP 1: Experimenting with algorithmically generated Music

Let’s start off by first looking at ways in which we can experiment with making music algorithmically. Unlike traditional composition done by people, algorithms are equally qualified to generate music following some pre-defined rules for generating patterns, both chromatically as well as rhythmically.

There are lots of resources and approaches for using algorithms to compose musical scores. Some are more accessible than others, and some require some degree of math and or programming to engage. To get a flavor for what we’re talking about, here are to examples of interactive tools to generate music:

If you want to dive in more deeply with an academic understanding, take a look at some scholarly works like these:

Now that you have a sense of what algorithmic-generated music is all about, let’s look at some software which we could use that generates music. Again, searching the web reveals some goodies:

  • expremigen - an expressive MIDI-Generation python-based tool.
  • canon-generator - a python-based library to generate canons.
  • isobar - A python-based construction kit with MIDI integration.
  • csound - A CLI and Qt-based IDE for composition and more. Extensive and requires significant learning.

STEP 2: lilypond

So now that we know how to generate some music, aside from playing it electrically, how can we give it to other musicians who might want to play our compositions on their instruments. To do that, we need some way of engraving our composition onto sheet music

  • the common notation that is familiar to musicians. Enter lilypond. Lilypond is a tool which lets us generate high-quality sheet music.

Note, nothing says we can’t use lilpond diretly with our own algorithmic approaches to generating music. That works too! But, but using a more compelling library, we can dive deeper into algorithmic composition without having to fully undertand all of the techniques at once.

STEP 3: performance

Generating music, and engraving music gives us great tools for composition and communicating our works. But let’s see if we can take things to the next level. Let’s experiment with playing our compositions. We’re going to look at two general forms for our compositions:

Playing MIDI files seems somewhat straight-forward. It will require some configuration, but once we have it set up, it’s as easy as playing any other media file.

What about sheet music? What if we can use programs that read our sheet music and play them automatically! Our final step is to experiment with programs that can “read” musical scores encoded in pdf and play them out to an audio device.

Next Steps

There’s a ton of information. Next, I’ll take a look at each of these ideas in turn, writing a daily post teasing some of it out and playing along the way. Our goal in the end is to develop the tools and techniques to become Maestro eComposers!

comments powered by Disqus