Self-reference in computer programming and hip-hop

Like this sentence, computer programs and songs can refer to themselves. Many computer programs and songs are made of loops within loops within loops. Self-reference gives computers their extreme versatility and it makes for richer, more layered music.

http://www.flickr.com/photos/jerkhaircut/3538413244/

Self-reference may also form the basis for our consciousness.

When I was in fifth grade, we did some programming on Apple IIe computers using Sprite Logo, a student-friendly version of the venerable programming language Lisp. In Sprite Logo, you move a cartoon turtle around the screen, though back in the eighties, it was more just an abstract triangle. The turtle has a pen attached to its tail, and by specifying its path around the screen, you can make it draw shapes. By default, the turtle begins in the center of the screen, pointed up. Here’s how you tell the turtle to draw a box one hundred pixels on a side in Logo-like pseudocode:

go forward 100 pixels
turn left 90 degrees
go forward 100 pixels
turn left 90 degrees
go forward 100 pixels
turn left 90 degrees
go forward 100 pixels
end

Here’s how to make the turtle draw an equilateral triangle:

go forward 100 pixels
turn right 120 degrees
go forward 100 pixels
turn right 120 degrees
go forward 100 pixels
end

By having the program refer to itself, you can tell Sprite Logo to repeat parts of the program, just like the repeat markers in music notation. You might draw your square by defining a procedure to draw a single side, and then just repeat the procedure four times:

repeat 4 times: (go forward 100 pixels, turn left 90 degrees)
end

Here’s how to draw the triangle using repeats:

repeat 3 times: (go forward 100 pixels, turn right 120 degrees)
end

You could draw five triangles spaced two hundred pixels apart like so:

repeat 5 times: (repeat 3 times: (go forward 100 pixels, turn right 120 degrees)), go forward 200 pixels)
end

A more modern way to draw five triangles is to create procedures called ’square side’ and ‘triangle side’, and then have the program run them a certain number of times:

define ‘triangle side’ as (go forward 100 pixels, turn right 120 degrees)
define ‘triangle’ as (repeat 3 (’triangle side’))
repeat 5 (’triangle’, go forward 200 pixels)
end

This kind of nested self-reference is so common in computer programming that it’s easy to forget how weird it is. Computer programs use exactly the same code for programs and the data the programs are acting on. Programs can use themselves as data. You can nest self-references within self-references to whatever depth you want. Such self-referential nesting is considered good programming technique, and most of the software we use every day is full of it.

Computer programming and music share a reliance on self-referential loops. No form of music is more self-referential than hip-hop. Rappers do a lot of rapping about their rapping, as in “My Melody” by Eric B and Rakim:

I’m not a regular competitor, first rhyme editor
Melody arranger, poet, etcetera
Extra event, the grand finale-like bonus
I am the man they call the microphonist

The most interesting piece of praise Rakim gives himself is later in the track:

I drop science like a scientist

In this case, a computer scientist.

In “My Melody”, Eric B takes the line “Check out my melody” and re-sequences its DNA, live on tape, using a sample of the song itself:

Ch-ch-ch-ch-check out, check out check out my melody.
Ch-ch-ch-ch-check out, check out check out my melody.

Digital audio supports effortless and endless recursion. You lose a little signal quality duing the encoding process, but once you have your list of ones and zeros, you can copy it flawlessly across any different medium, as many times as you you want. It’s not uncommon for DJs and producers to heavily sample themselves, or their own projects, and it’s not uncommon to use samples of samples of samples.

recursion-in-hiphop1

Any song that samples the ubiquitous “Funky Drummer” remix is already a remix of a remix. This is before we come to the uncountable thousands of samples of tracks based on samples of the remix, or samples of those tracks.

A particularly remarkable knot of self-reference is “The Score” by The Fugees, from their album of the same name. It’s based on samples of “My Melody,” “Dove” by Cymande and “Planet Rock” by Afrika Bambaataa, itself based on interlocking excerpts of other tracks. “The Score” also includes samples from every other song on the album “The Score”, and those songs mostly contain samples of still other songs:

To heighten the self-reference further, hip-hop musicians have followed James Brown’s example and brought the recording process into the finished product. Mic checks and one two count-offs are a crucial part of the song’s lyrical content, and more than a few tracks use looped samples of the MC’s coughing.

Douglas Hofstadter thinks that self-reference is the key to consciousness. That could explain why it’s such a source of fascination for me: I’m seeing a reflection of myself.

  • Share/Bookmark

Tags: , , , , , , , , , ,

One Response to “Self-reference in computer programming and hip-hop”

  1. Hip Hop says:

    thank for sharing

Leave a Reply