Bubble sort is the simplest list sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. A midi file is a electronically encoded musical score. Each note and its qualities, (duration, volume and midi channel (which instrument the note is assigned to)), are placed in a time line, very much like a piano roll for an automated pianola.
Bubble Sort, bubble sorts midi files. Discarding the original note position, Bubble Sort reorganises the notes, volumes, durations and midi channels, into a new linear, sequential score, like the Morecambe and Wise joke on André Previn. It’s all the right notes but not necessarily in the right order.
A midi note can be represented as a string of numbers such as 64,100, 350,10, which represent the note, volume, duration and midi channel respectively. Bubble Sort can bubble sort the list of notes in a score using any of these values, or combination of these values, in comparison to the rest of the score.
If Bubble Sort, when bubble sorting, comes across a polyphonic event (two note events played at once) Bubble Sort will always take the highest pitch as occurring first (just as it appears in the machine code of the midi file). This is important, as Bubble Sort bubble sorts in a FIFO manner, that is, in a “First In First Out” manner. When bubble sorting data with a four way query, the order Bubble Sort bubble sorts the elements of the data string, and the original order of the data matters, and will give different results.
When playing back the results, Bubble Sort can control the speed of the play back, at x1 play back speed Bubble Sort plays each note one at a time and moves onto the next note when the previous note finishes. For polyphonic pieces this could mean an increase in length of a composition at an exponential level. For this reason, and for normal performances, Bubble Sort can speed up the process but still can also slow down the process to highlight elements and detail. A faster speed may also unlock details otherwise previously unnoticed. Whatever the speed Bubble Sort plays back the composition, the notes remain at their original length only the gaps between the notes change.
For source material, Bubble Sort likes to find midi files on the web. In this case, the back catalogue of The Beatles provides the source, and Bubble Sort uses the quicktime general midi synthesiser for playback. Another detail worth noting is that in most midi scores the percussion is positioned on midi channel 10.