A program that converts sorting algorithms to MIDI melodies. Inspired by Sound of Sorting (but is much more musical!).
An array is first filled with 5 octaves of a chosen scale in base C and shuffled. It is then sorted using a chosen sorting algorithm, playing the corresponding note each time an element is moved. The results can be very beautiful or very weird (or both).
If you import the resulting MIDI file into a DAW (Logic Pro in this instance), you can clearly see the patterns created by the sort. It's quite an interesting visualization.
7 sorting algorithms are currently supported:
- Bubble Sort
- Insertion Sort
- Quick Sort
- Merge Sort
- Heap Sort
- Radix Sort (LSD)
- Bogo Sort
8 scales are currently supported:
- Major
- Harmonic Minor
- Natural Minor
- Melodic Minor
- Chromatic
- Pentatonic Major
- Pentatonic Minor
- Blues
Run the program with java -classpath ./bin sorttomidi.SortToMidi
and follow the prompts in the console. You can also import this project into Eclipse (File > Open Projects from File System...
).