Skip to content
Permutations can be considered as the orbits of a dynamic system. This code translates those orbits into simple and not-so-simple 3-voice music scores.
LilyPond C CWeb Shell Makefile
Branch: master
Clone or download
Eidonko Update
added a space
Latest commit 02f6644 Nov 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
accccegghijj-contrabbasso, overdrive guitar, yang quin.ogg


The idea is simple: I consider generation of permutations as a dynamic process in which a successor permutation p' is generated from an input permutation p.

I take those orbits, I break them into three chunks, map each chunk to a note, and play the three notes together -- that's it.

The thing that strikes me is that this gives rise to patterns that, at least to me, seem interesting. An example is 001112222, available on my soundcloud account: and as a MuseScore file at

This non-triviality may be due to the fractal nature of the process. In fact, when mapping the same process on a 3D space, I get images that are self-similar and, according to the Fractalyse tool, are characterised by a fractal dimension (see e.g.; image produced with


Czech composer Flavigula has published a piece of music that uses my approach!

Here is their "Šest":, and here is their announcement:

Flavigula's toot

I received warms words of encouragement from another musician, JS0000

I'm very grateful, as this encourages me to do more and better!

Js0000's toot

I have been collecting a number of compositions that are based on my approach.

They may be found in this videolist: and on youtube in my "Eidon' Songs" channel. Here is partial list:

I call the above compositions Grundgestalts, because this is the term introduced by Schönberg for this class of generative processes. I find this quote particularly interesting and enlightening:

"Whatever happens in a piece of music is the endless reshaping of the basic shape ... There is nothing in a piece of music but what comes from the theme, springs from it and can be traced back to it; to put it still more severely, nothing but the theme itself" (Arnold Schönberg, ‘Linear Counterpoint’, 1950).

This is in fact what happens with the music generated here: the first chord is x, the second f(x), the third f(f(x)), and so forth. Everything is pre-dermined and springs from the theme, x.


$ ./ _string_

where string is a string of digits with a length that is a multiple of 3.

Try for instance:

$ ./ 001111122

This generates (Lilypond source), 001111122.pdf (pdf score), 001111122.mid (MIDI score), and 001111122.mp3 (mp3 of the score):

$ 001112222
Processing permutations of 001112222
Processing `'
Interpreting music...[8][16][24][32][40][48][56][64][72][80][88][96][104][112][120][128][136][144][152][160][168][176][184][192][200][208][216][224][232][240][248][256][264][272][280][288][296][304][312]
Preprocessing graphical objects...
Interpreting music...
MIDI output to `001112222.mid'...
Finding the ideal number of pages...
Fitting music on 7 or 8 pages...
Drawing systems...
Layout output to `'...
Converting to `./001112222.pdf'...
Success: compilation successfully completed
Playing 001112222.mid
MIDI file: 001112222.mid
Format: 1  Tracks: 4  Divisions: 384
Sequence: control track
Text: creator:
Text: GNU LilyPond 2.18.2
Playing time: ~319 seconds
Notes cut: 0
Notes lost totally: 0

Output of this very example is available on .

...In more details and execute as a pipeline of processes:

  • perm string creates a file of "triplets": integers translating a permutation into three comma-separated integers corresponding to the three chunks mentioned at the top. Let me call this file "the datfile"
  • data2lily -i datfile -o lilypondfile -m 'instrument1' -m 'instrument2' -m 'instrument3' : this one converts the datfile into the Lilypond source lilypondfile, specifying as MIDI instruments instrument*
  • lilypond lilypondfile : creates the MIDI file and (when using permusic.h) tries to create a PDF score
  • timidity midifile -O w wavfile : converts the MIDI file into a WAV file
  • lame --abr 160k wavfile mp3file : converts the WAV file into an MP3 file

The WAV file is then deleted.


Note: requires

Note: TiMidity requires soundfonts and a proper configuration thereof. I would suggest you to follow the guidelines at

More information

Feel free to contact me at


  • V0.1 2018-06-17: Added options -L (with layout; default) and -l (without layout). When calling lily2data with -l, score is not printed and only the midi file is created. Now stops when one of the production stages fail. New script is the same as permusic.h but option -l is issued for lily2data (see above).
  • V0.2 2019-07-09: Removed bug in and in Makefile Improved
You can’t perform that action at this time.