malloc

What’s the sound of a computer program running?

Normally, nothing – the number crunching that takes place as software allocates memory forms patterns, but not ones that might immediately make sense of sound. “malloc” is a C function that allocates memory in which code executes. But a simple hack takes the output of a compiler, and makes sound files out of it. It’s the equivalent disconnecting the pipe from a widget-making factory, and instead of producing useful tools, making cool shapes out of sugary icing – useless and delicious. It’s a sonification of the memory allocation and reading process itself, so that patterns in that data, applied to an auditory timescale, form oscillations, blips and bleeps, and sometimes, sounds that to our ears begin to resemble synthesized basslines and percussion.

You actually don’t have to know anything about code to try this out; you just need to paste some lines into a command line. That means you could make your own sounds with the tool if you like. (Your life will be easier if you use Linux or OS X; Windows users will need to look up how to get a UNIX command line working – like Cygwin or GOW.)

The author has already posted some “musical” examples to SoundCloud. My favorite is the first one; it’s almost listenable as a glitch track. (More than almost, actually, at least if you’re a bit weird like me; I’ve been oddly soothed by letting it run for a bit in the background.)

Creative Commons-licensed – non-commercial, so sorry, you can’t turn in this file as the music bed for that Audi ad you were commissioned to make. (And you were all set to explain to them that this is what “dubstep” means to kids now.)

Sounds like it can also make some damned fine basslines. malloc(), the new 303:

This one… gets more interesting later. (Best use of this comment ever: “where’s the drop?”)

So good.

The project is the work of Thomas Gordon Lowrey IV, aka gordol. On his GitHub, he makes all sorts of productive things. None can match for me taking 67 lines of code and nerding out.

https://github.com/gordol/malloc-ld_preload-sounds

It’s also fun watching SoundCloud decide what tracks should be related. Dear Universal: try to take this down.

Thank you, Myles Ashley Borins.

  • Aaron Ransley

    Superb :)

  • Max

    I like the idea, but 20 minutes of random c-64 blibs aren’t very entertaining.

    • http://pkirn.com/ Peter Kirn

      Well, you might edit them.

      I guess I was intrigued that because of using malloc(), there’s a lot of pattern in them…

  • Guy Sigsworth

    I believe Alva Noto made an album where all the sounds were created by renaming the non-audio files on his computer as “.wav”.

  • pichenettes

    For the sake of accuracy, this has little to do with compilers. This is a sonification of two essential activities performed by computer programs: reserving memory and reading data from files. The frequency and duration of the bleeps depend on the size of the data read/allocated. Any program can be sonified in this way (including, but not limited to compilers). That it sounds like square waves is a decision made by the programmer of the sonification tool. One could have made other decisions – such as playing a kick every time a small memory block is reserved, a snare every time a large block is allocated, and a cowbell on file reads (at a slowed-down timescale of course)…

    • http://pkirn.com/ Peter Kirn

      This is of course a vastly better explanation than my muddled first draft.

      Now, there is something different in how you hear the patterns, I think, between going with that larger timescale as a score and assigning instruments, versus directly synthesizing sounds using the data as control data for square waves and the like… the principal is the same, but the relationship of the sounds to patterns in the data can be closer.

  • John Moon

    hmmm… reminds me of opening a Reaktor file (.ens) as audio in Audacity… they come out surprisingly interesting.

  • http://www.matthewpetty.com/ Matthew Petty

    See also the sounds of sorting algorithms: https://www.youtube.com/watch?v=kPRA0W1kECg

  • draeger

    you can do something similar very easily by cat’ing any file to /dev/snd

    https://unix.stackexchange.com/questions/13732/generating-random-noise-for-fun-in-dev-snd

  • http://www.cassiel.com/ cassiel

    Nice to see a 40-year-old technique finally get the publicity it deserves. The ancient ICL 4/75 mainframes that were being decommissioned when I did my CS degree had loudspeakers fitted to the CPU control panels, so that operators could listen to the CPU and tell if anything was amiss. Some years later, I was programming a Terak 8510/A with such a small amount of RAM (56K) that the stack and heap grew towards each other during compilation, encroaching onto the video RAM, so that you could see how close you came to running out. That would make a good VJ accompaniment.

  • robjac

    Everybody should check out the toplap.org community.

    there are far more expressive live-coding approaches to music.

    tidal
    supercollider
    overtone +clojure

    etc.

    I usually run atmosphere sounds via JackOSX in the command line into and ableton live return track. Allows for very cool, non synched textures.

    • http://pkirn.com/ Peter Kirn

      Oh, it’s very cool – this was just a really cool hack, I thought.

  • Foosnark

    It works up into a nice complex rhythm there. Good stuff.

  • lrp

    Dig the tracks for what they are: awesome. Dakujem for the opportunity to enjoy them.