De Bruijn sequences for musical dexterity


I wanted to make some musical exercises that would include every possible pairing of one note followed by another. Actually, lets not limit ourselves, an exercise that contains every possible sequence of notes up to a given length.

How? De Bruijn Sequences.

This is a script that will produce a de Bruijn sequence as an ABC music file.


python <k> <key> <notes>

Example: generate an exercise containing all 3-mers that can be formed from a pentatonic scale.

python 3 C C D E G A c

Then, eg, paste the result into the ABC Convert-A-Matic.

Result: exercise.pdf

Turning some dials up to eleven: eleven.mp3 twelve.mp3