Listen to Quantum Computer Music


Normal version

I spent some time playing around with libquantum, the free quantum simulation library, and created two musical compositions that represent the inner workings of a quantum computer. So if you'd like to know what a quantum computer sounds like, here's your chance!

The first composition is a setting of Grover's algorithm, telling the heroic tale of the search for a record in a database. It closely follows Grover's original proposal, with each note corresponding to the addressing of a qubit. So essentially, you are listening to the music the programmer of the quantum computer plays on his quantum keyboard. You can easily hear some distinctive features of quantum algorithms. As a result of their reversible nature, quantum algorithms have many repetitions of their basic building blocks, which of course is also a common concept in music. You might also notice that there are both sequences of single notes and of chords. These correspond to single-qubit quantum gates and multi-qubit quantum gates, respectively.

The second piece is about Shor's algorithm for prime factorization. The most obvious difference to the Grover track is that it is much longer. Factorizing 15, which is the smallest number for which Shor's algorithm can be used, already takes more than 4,000 quantum gates! The whole piece also sounds more complex, which is due to the main operation, modular exponentiation, being fairly sophisticated, even if you use the clever implementation by Beckman et al. Shortly before the end (at 13:14), you can hear that a different part begins. This is the quantum fourier transform, which takes much less time than the modular exponentiation, but is the real deal-maker that renders Shor's algorithm superior to its classical counterparts.

So how did I do it? First, I used libquantum's quantum object code interface to cast the gate sequences for the demos shipped with libquantum into a human-readable form. Then I wrote a small Perl script that converts the quantum gates into musical notes, with each qubit addressed in a gate corresponding to a different pitch. For both pieces I used a pentatonic scale in order to keep dissonances to a minimum. If you're interested you can download the score files for Grover's and Shor's algorithm, respectively. From these scores I created a MIDI file with MIDI::Simple, which were finally rendered by the TiMidity++ software synth.

Copyright 2006--2011 Hendrik Weimer. This document is available under the terms of the GNU Free Documentation License. See the licensing terms for further details.