# Eidonko / CombinatorialMusic

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
`added a space`
Latest commit 02f6644 Nov 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
001112222-vlc.mp4
001112222.dat
001112222.jpg
001112222.ly
001112222.mid
001112222.mp3
001112222.pdf
Makefile
accccegghijj-contrabbasso, overdrive guitar, yang quin.ogg
data2lily.exe
data2lily3new.c
data2lily5.c
music-20191108.png
music-20191110.png
perm.c
perm.w
permusic.sh
permusic_nopdf.sh

# CombinatorialMusic

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: https://soundcloud.com/user-373798924/001112222a and as a MuseScore file at https://musescore.com/user/29896662/scores/5638047

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. https://www.dropbox.com/s/rrjqrffx9bqzuxh/001112222.jpg?dl=0; image produced with https://github.com/Eidonko/Permutation-feed-povray).

## News

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

Here is their "Šest": https://exode.me/videos/watch/95c0f6a2-2423-4189-a6f9-5908e1efaf2c, and here is their announcement: https://sonomu.club/@flavigula/103096645941388869

### I received warms words of encouragement from another musician, JS0000

I'm very grateful, as this encourages me to do more and better! https://sonomu.club/@js0000/103109313152388102

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

They may be found in this videolist: https://open.tube/my-account/video-playlists/94a9f75c-b2b3-4641-8f67-b94aa30960b0 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.

## Syntax

``````\$ ./permusic.sh _string_
``````

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

Try for instance:

``````\$ ./permusic.sh 001111122
``````

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

``````\$ permusic.sh 001112222
Processing permutations of 001112222
Processing `001112222.ly'
Parsing...
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 `001112222.ps'...
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 https://soundcloud.com/user-373798924/001112222a .

## ...In more details

permusic.sh and permusic_nopdf.sh 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.

## Requirements

Note: permusic.sh requires

Note: TiMidity requires soundfonts and a proper configuration thereof. I would suggest you to follow the guidelines at https://www.rosegardenmusic.com/wiki/setting_up_the_fluidr3_gm.sf2_for_timidity.