|LIBRARIES & FRAMEWORKS USED||LilyPond for sheet music generation. Mingus for working with musical logic. Sphinx for generating documentation.|
It’s important for musicians to know how to move around keys and chords in their respective instruments. I’m crazy enough to attempt playing multiple instruments, so I wanted a way to study scales/chords for several instruments without having to buy several scale books.
For some time, I’ve been playing around with LilyPond, so I knew how to generate sheet music through code. I also knew that scales and arpeggios usually work the same way across different instruments. I just needed a way to connect those dots, and I’d be set.
Python and mingus are the keys to this project. Mingus is a music theory library for Python, which allowed me to program with musical logic. So I can define the various scales, keys, and chords that I wanted to work on. From there, I dynamically created a LilyPond source file for each étude book, which contains a series of exercises. I could then use LilyPond to compile each file, resulting in a series of PDFs.
I also allowed the app to read from a config YAML file, so I don’t have to tweak values in the code itself. This is very useful if I wanted to create a book for another instrument, or tweak the range of an existing instrument. For example, here’s the config block for a violin book:
The config block above shows information for each instrument, the keys to include in the book, and various options for presentation.
You can see the rest of my code at GitHub.
Check ‘em out!