This Is What Popular Sorting Algorithms Sound Like

The universe of data visualisation is infinite. Just when you think you have the definitive way of representing a complex concept, someone cracks out a better (or just plain cooler) approach. Take sorting algorithms, which we've seen reproduced in folk-dance, now tackled by an 8-bit symphony.

A few years ago, a programmer by the name of Timo Bingmann wrote a tool called the "Sound of Sorting". In it, you can run a number of popular sorting algorithms -- quicksort, insertion, merge, etc. -- and not only will it produce a visual, but an aural experience too.

The question now is, how does the program produce the soundtrack, which as Bingmann himself describes, has a "'8-bit game tune' feeling"?:

The generated sound effects depend on the values being compared. Only comparisons yield sound output (except for in radix/bucket sort)! The length of each comparison's sound effect can be modified using the "Sound Sustain" slider. The frequency of the sound is calculated from the compared values.   The sound wave itself is triangular and modulated with an ADSR envelope ... An item value is scaled (with double precision) to the frequency range 120Hz -- 1212Hz, which is large but not too high to be annoying.

Bingmann created the Sound of Sorting for various reasons, but one of the major ones was providing a teaching tool for computer science students (or anyone interested in the internals of sorting). For example, the tool has the ability to slow down the sort, so you can see exactly how each stage functions.

If you're not keen on downloading the program itself, the video above does a good job of showing it in action.

Sound of sorting [Panthema]


Be the first to comment on this story!

Trending Stories Right Now