1:"$Sreact.fragment" 2:I[3477,["3477","static/chunks/3477-0421d93bddadbfa1.js","7970","static/chunks/7970-d7365790136fd3c6.js","8173","static/chunks/8173-e6014a7c7c72b819.js","7177","static/chunks/app/layout-ef93bd704121c064.js"],"PrimeReactProvider"] 3:I[1950,["3477","static/chunks/3477-0421d93bddadbfa1.js","7970","static/chunks/7970-d7365790136fd3c6.js","8173","static/chunks/8173-e6014a7c7c72b819.js","7177","static/chunks/app/layout-ef93bd704121c064.js"],"default"] 4:I[5244,[],""] 5:I[3866,[],""] 6:I[4547,[],"ClientSegmentRoot"] 7:I[534,["3638","static/chunks/3638-f1f02ef1fcf10760.js","8173","static/chunks/8173-e6014a7c7c72b819.js","7317","static/chunks/app/music/layout-599e2961acaea74a.js"],"default"] a:I[6213,[],"OutletBoundary"] c:I[8201,["3477","static/chunks/3477-0421d93bddadbfa1.js","7557","static/chunks/7557-b47427b12054591b.js","6285","static/chunks/app/music/loading-ea081eac59ec23dc.js"],"ProgressBar"] d:I[6213,[],"MetadataBoundary"] f:I[6213,[],"ViewportBoundary"] 11:I[4835,[],""] :HL["/_next/static/media/2a74f8506348f317-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/media/446d1707e5f1a39c-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/media/6f660a59a11c2e92-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/media/dfdb468a3c873451-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/css/96cedf312e4e263f.css","style"] :HL["/_next/static/css/5d4a6a7c4ee1bb95.css","style"] :HL["/_next/static/css/a3225c76136ce828.css","style"] :HL["/_next/static/css/90516eb4620c8dd8.css","style"] :HL["/_next/static/media/0b30a44b5eb1a594-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/css/895569f5a5b4b3f2.css","style"] :HL["/_next/static/css/24bfbaae65c33c29.css","style"] 0:{"P":null,"b":"__ibJiCMDbia4YK-1yOgm","p":"","c":["","music","works","sorted-affairs"],"i":false,"f":[[["",{"children":["music",{"children":["works",{"children":[["slug","sorted-affairs","d"],{"children":["__PAGE__",{}]}]}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/96cedf312e4e263f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/5d4a6a7c4ee1bb95.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/a3225c76136ce828.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","3",{"rel":"stylesheet","href":"/_next/static/css/90516eb4620c8dd8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"antialiased","children":[["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[],[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}],["$","script",null,{"async":true,"src":"https://cdnjs.cloudflare.com/ajax/libs/raphael/2.2.7/raphael.min.js"}]]}]}]]}],{"children":["music",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/895569f5a5b4b3f2.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","$L6",null,{"Component":"$7","slots":{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","music","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]},"params":{},"promise":"$@8"}]]}],{"children":["works",["$","$1","c",{"children":[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","music","children","works","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["slug","sorted-affairs","d"],["$","$1","c",{"children":[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","music","children","works","children","$0:f:0:1:2:children:2:children:2:children:0","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":["$L9",[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/24bfbaae65c33c29.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","$La",null,{"children":"$Lb"}]]}],{},null,false]},null,false]},null,false]},[["$","div","l",{"style":{"objectFit":"cover","display":"flex","justifyContent":"space-around","alignItems":"center"},"children":["$","$Lc",null,{"mode":"indeterminate","style":{"height":"6px"}}]}],[],[]],false]},null,false],["$","$1","h",{"children":[null,["$","$1","cUZzYOqZHyiOI4jJqPLGc",{"children":[["$","$Ld",null,{"children":"$Le"}],["$","$Lf",null,{"children":"$L10"}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}]]}],false]],"m":"$undefined","G":["$11","$undefined"],"s":false,"S":true} 8:{} 12:I[8173,["3477","static/chunks/3477-0421d93bddadbfa1.js","7557","static/chunks/7557-b47427b12054591b.js","8023","static/chunks/8023-c64fcdb972224576.js","8173","static/chunks/8173-e6014a7c7c72b819.js","7037","static/chunks/app/music/works/%5Bslug%5D/page-a376a9756a30d3c2.js"],""] 13:I[2099,["3477","static/chunks/3477-0421d93bddadbfa1.js","7557","static/chunks/7557-b47427b12054591b.js","8023","static/chunks/8023-c64fcdb972224576.js","8173","static/chunks/8173-e6014a7c7c72b819.js","7037","static/chunks/app/music/works/%5Bslug%5D/page-a376a9756a30d3c2.js"],"Button"] 14:T1e2c,

A piece for Internet browser, in five movements:

  1. Quicksort
  2. Selection Sort
  3. Heap Sort
  4. Merge Sort
  5. Stooge Sort

Click on the links above for a performance of each movement.

The latest version of Chrome or Firefox are recommended for this performance


 

If you are unable to hear the audio on your browser, you can listen to the mp3 renderings on SoundCloud, but it’s really not the same without the visualizer…

Composition

This piece was written over the course of several months.  About half of the time was spent developing the interactive program to perform the piece (which was difficult, as MIDI has surprisingly poor support in web development);  The rest of the time was spent painstakingly selecting and ordering pitches for each movement. The biggest challenge was choosing a pitch set and sequence that would produce some sort of harmonic structure when processed, rather than simply droning on a pentatonic scale.  For each type of sort, I had to adopt a different strategy for note ordering, as each algorithm interacts with notes in a different order.

For some sorts, like selection sort, this process is a little easier, as the behavior of the algorithm is fairly predictable (for all of you C.S. nerds out there, yes, obviously they are all technically ‘predictable’, but you know what I mean).  For others, particularly quicksort, things are much more complicated: changing one pitch in the sequence will completely change the flow of the algorithm.  As a result, a great deal of the process was trial-and-error.

That doesn’t mean the process was random.  There were many careful considerations made along the way.  For example, take merge sort:

In merge sort, the first half of the sequence is sorted first, and the first half of that half is sorted first, and the first half of the first half of the first half is sorted first, and so on…  Because these fractions of the sequence are processed by the algorithm in isolation, I was able to create harmonic movement by grouping pitches that implied certain harmonies within quarters and eighths and sixteenths, etc., of the sequence.  Most notably, the second half of the sequence is the first half of the sequence modulated up an octave and a fifth, which gives the impression of a key change.  Why an octave and a fifth, rather than just a fifth?  Because the more out-of-order a sequence is, the longer merge sort takes.  One of the major considerations for this movement was keeping the shape of the sequence somewhat sorted to reduce the amount of time spent merging the quarters and halves of the sequence.  If you take the exact same set of pitches and order them randomly before sorting, not only do you lose the harmonic coherence, but you spend about an extra minute and a half listening to descending scales during the merges.

Want to give it a try yourself?  Feel free to use my program to create and share your own sorting compositions!

 

mergesort-visual

 

9:["$","article",null,{"className":"single-work","children":[["$","header",null,{"children":[["$","p",null,{"children":["$","$L12",null,{"href":"/music/works","children":["$","$L13",null,{"icon":"pi pi-arrow-circle-left","iconPos":"left","label":"more works"}]}]}],[["$","h1",null,{"children":"Sorted Affairs"}],["$","h2",null,{"className":"work-voicing","children":["for ","Internet browser"]}]]]}],["$undefined",["$","div",null,{"className":"columns","children":[["$","main",null,{"children":[["$","section",null,{"children":[["$","label",null,{"children":"Approximate performance time:"}]," ","10 min.",["$","br",null,{}],["$","label",null,{"children":"Year composed:"}]," ","2014"]}],["$","section",null,{"dangerouslySetInnerHTML":{"__html":"$14"}}],""]}],["$","aside",null,{"children":["$","section",null,{"children":[[],[],[]]}]}]]}]]]}] 10:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] e:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Casey Rule"}],["$","meta","2",{"name":"description","content":"Composer and Software Engineer"}],["$","link","3",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] b:null