I wrote poetry as an angsty teenager, like so many before me. I even continued into my twenties and beyond (if you are looking to cringe at it - here is a sample).
The thought of using a poem as code has been pinging around my brain for years, but time, time has not been on my side on this one. Then, agents became a thing. And like so many of my endless free-time projects lately, this one came about through my thoughts and an agent’s “fingers”.
A note on who wrote what
This entry has two voices. The diagrams, their captions, and the summary are Claude Code’s work, drawn from what the compiler actually did with these two stanzas. The rest is me. That’s why the captions sound far more sure of themselves than I do; they’re as much an explanation to me as to you.
The idea
I wanted the music to reflect the poem’s structure, the poet writing a score unknowingly. The meter defines the rhythm, the rhyme becomes the melody, every repetition defines the arrangement and the rarity of the words defines the timbre - uniqueness laid bare.
We do need to be able to alter the outcome a bit, so the poem can define a style in the header, which will result in a change of sound, but the timings are bound to the form itself.
The compiler reads the poem once and runs independent passes over it. Each pass owns one musical dimension, and every event it emits keeps a pointer back to the bytes of the poem it came from.
The test subject: The Tyger
Tyger Tyger, burning bright,
In the forests of the night;
What immortal hand or eye,
Could frame thy fearful symmetry?
In what distant deeps or skies.
Burnt the fire of thine eyes?
On what wings dare he aspire?
What the hand, dare seize the fire?
Why choose Blake? In all honesty, why not? The poem is a test subject - it is the source code.
What will the next steps make it into? Beats me if I am honest. I used iteration to get to something I found even slightly satisfying. I listened to it quite a bit, unsure now if I enjoy it because of the number of times I listened to it, or because it is really good.
Meter becomes rhythm
Reading what came out, I learned words like ‘trochee’ and ‘syncopation’. Learned is generous; read is closer. The main point is, taking what poetry theory says about a poem and treating it as data, then slowly massaging the result into something listenable. Pretty much it.
Line → bar, foot → beat, syllable → subdivision, stress → how hard the kick is struck. A foot of three syllables splits its beat in three; a line with only three feet rests on its fourth beat.
Rhyme becomes melody
The rhyme defines melody, the absence of it defines silence.
The melody is the rhyme words and nothing else. Each rhyme class takes the next free degree of the scale, in order of first appearance: bright/night → D, skies/eyes → E♭, aspire/fire → F♯. eye and symmetry do not rhyme by the dictionary, so bars 3 and 4 have no tune at all.
Vowels become the bass
Here we start getting close to grasping at straws. The bass must come from somewhere, so it comes from the vowels.
Every stressed vowel of a foundation line plays a bass note picked by how open the mouth is: open vowels sit on the root, mid vowels on the third, close vowels on the fifth. The rhyme words are left out because they carry the melody instead.
Sound becomes timbre
Some words are used more often than others, but these are generally not interesting. So the most common words go dull (“the” turns up again and again and sounds muffled every time), while “symmetry” comes out bright enough to cut through.
Two passes shape how each word sounds rather than when. The bar above a word is its sharpness: rarer, more phonetically novel words get a brighter filter and a harder attack, so “forests” and “symmetry” cut through and every “the” is dull. The underline is its bank: words that alliterate or share a vowel share an instrument, so “Tyger Tyger” is one timbre and “burning bright” another.
Repetition becomes arrangement
The sound was initially quite boring, monotonous, and it would also end up being short and without any repeating elements. So I poked and prodded, working with the agent to define what else we could use to put some meat on the bones.
Eight lines become 24 bars. Stanza 1 is stated, then keeps looping. Stanza 2 doesn't follow it, it takes it over, one line per pass, until the loop is entirely stanza 2. The comma in “Tyger Tyger,” makes that half-line a call that loops underneath the whole time. “skies” and “aspire” are open rhymes, so the first time through, their lines keep sounding under the bars that follow while they wait for “eyes” and “fire” to answer them.
Hear it
Try it at prosody.rocks - you can play with knobs, use presets and see how the poem lights up as the score plays, showing you what came from where. The code is at mpecan/prosody-experiment.
What doesn’t work yet
Much of it doesn’t work well. The algorithm needs work. Some settings will make it sound like a cat being tortured. But that is what makes it fun for me, so if you want it to be different, play with it, alter the code, and if you feel like it - send me a pull request.
Comments
Loading comments...