More music of the dwarves

Tags: musichistorycomposition

I've written before about the music of Dwarf Fortress - not just music to listen to while playing (which is the main thing you can find if you search the Web for this topic) but the music described in-game. The game simulates a procedurally-generated fantasy world full of different species of intelligent creatures (dwarves, elves, humans, etc.); game characters sometimes are described as playing music; and for each simulated culture, the game software generates a description of that culture's music.

Perhaps wisely, the developers are not attempting to make the game really generate and play the music that the characters are supposed to be playing. It only displays general text descriptions that players can read. But these descriptions do contain enough technical detail that in principle it might be possible to write music meeting the descriptions - and then we can find out what dwarven music really sounds like!

I've been experimenting with writing music to meet the procedurally-generated descriptions from Dwarf Fortress games. The result isn't wonderfully listenable because of the apparent limitations of the description-generator. It often describes things that don't really make musical sense. But trying to come up with things that meet the description and also sound like they could plausibly be music (even if music for alien ears) is a fun exercise. It's a way of thinking outside the box, and it's also an excuse to do some synthesizer patching.

Extracting descriptions from the game

When you generate a world in Dwarf Fortress, the game creates some number of civilizations, each with its own musical traditions including instruments, styles, and specific compositions. When you're supervising a dwarf fortress (the usual way of playing the game), your dwarves can make instruments (or buy or seize them from other cultures) and if you create a tavern or a temple and stock it with instruments, they will naturally tend to sometimes play those instruments and perform music for their own entertainment or religious purposes. There are also things you can do to encourage travelling performers from other civilizations to come to your fortress and perform their own music.

I'm reasonably successful with building megaprojects in Dwarf Fortress, so my first thought was to just set up a fortress and have it be a musical fortress. I'd accumulate a lot of instruments, let the dwarves do their thing, and capture all the descriptions that came up. I built a fortress intending to run it like that, but it was too close to a necromancer's tower and there were near-constant zombie sieges. Although the dwarves were basically able to defend themselves from the zombies, it left me with very little labour available for making musical instruments, and then there was a lycanthropy plague that took the population down to three dwarves, two of them infected and the remaining one insane. Even if I might have been able to fight back from that situation, it didn't seem worth it when I'd built the fortress just for the purpose of capturing game-generated music descriptions anyway, so I abandoned that fortress to the zombies.

On my next attempt I managed to stay out of range of the necromancers. There were still a lot of goblin attacks but the fortress basically thrived, and I was able to build a tavern that attracted dozens of foreign performers. That fortress, which I've saved and may play for a while longer, was Dîbeshoddom "Crazycloisters"; the tavern is shown below.

With the fortress up and running, I sat back and waited for the dwarves to start making music... and waited, and waited. I don't know if I'd made some sort of mistake that resulted in attracting a lot more poets and storytellers than musicians, or if there are other factors governing what dwarves actually tend to do in their spare time, but my dwarves really didn't seem to want to make any music. The main activities in the tavern were poetry recitations, stories (really boring ones too, if I'm to judge from the descriptions), and - especially as the goblin sieges got longer and longer and people grew tired of each others' company - drunken brawls.

When I did finally catch the dwarves playing music in the tavern and take a look at the description, I was disappointed to find that in nearly every case, they'd be performing one of the foreign musical forms brought in by visitors from distant parts of the world, and since they only had native instruments and a few bought from neighbours, they didn't have the right instruments for the form. So the performers would "simulate" the missing instruments - beatboxing or doing air guitar or whatever - and that's fine in itself but the game does not actually tell you the description when the performers are simulating an instrument. I might have a description of a musical form that says it's to be played on a flurb, and a dwarf executing the job "Simulate flurb," but no information about what a flurb is.

The pattern seemed to be that in fortress mode I'd have to do a lot of work just for information that would probably be incomplete anyway. Back out in "legends mode," where you just look at the world without anything happening, I had hoped that there'd be a section that just describes all the music and instruments of each culture, but seemingly not. What remained was to try to get the information out of adventurer mode, and that turned out to be the most efficient way to do it.

From my experiments in fortress mode I had descriptions of several musical forms, and I picked The Tressed Silk as the one from which I thought I could most likely make something musical. Here's the first paragraph of that.

The Tressed Silk is a form of music used for entertainment originating in the Towers of Gladness. The rules of the form are applied by composers to produce individual pieces of music which can be performed. The music is played on two ogon and a zarut. The musical voices bring melody with harmony. The entire performance is at a free tempo. The melody has long phrases throughout the form. It is performed using the alak scale and in the ugog rhythm. Throughout, when possible, composers and performers are to play arpeggios and play legato.

Note that "ogon" is apparently both singular and plural: one ogon, two ogon.

Right, so, I just needed to send an adventurer out to the Towers of Gladness to find out what an ogon and a zarut are. In fact, it was even easier: I generated a character who was a member of the Towers of Gladness, with "demigod" status, and threw all her character points into music-related attributes and skills. Once the game started I could go into the "talk" menu to start a performance, and one of the pieces of music my character already knew happened to be an instance of The Tressed Silk. She didn't have an ogon or a zarut, but it gave me options to "simulate" those instruments and - unlike in fortress mode - the descriptions of what the instruments actually are were shown in the "simulate" selection screen. It was easy to screen-shot them. If I'd known about this I could have skipped the fortress mode activity entirely. A newly-generated musician adventurer automatically knows a fair bit about his or her own culture's music that we can just read out of the game screens without needing to play as such, and that's the course of action I'd recommend to others who want to try this kind of experiment.

Patching the ogon

It turns out that an ogon is basically a set of bagpipes.

The ogon is a mid-size hand-held wind instrument through which constant air flow is maintained by use of a leather bag, itself supplied by a ceramic blowpipe. The musician selects the pitch by stopping holes in the wooden melody pipe attached to the bag. The melody pipe is a cylindrical bore tube. Two ceramic drone pipes provide constant accompaniment. The instrument has a nearly four octave range going from a middle to a very high pitch. At all pitches, the instrument has a quavering timbe. It has three registers. The low register has a watery timber. The middle register begins at mid-high pitch and has a raucous timber. The high register begins at high pitch and has a strong strident timbre.

To synthesize an ogon completely it sounds like we need four different kinds of sounds, probably four patches, for the drones and the three registers. But the Tressed Silk actually only uses the ogon in their "strident high register," so I can get that down to two patches.

Each ogon always should perform with feeling. The voice stays in the strident high register.

There are a lot of gaps that need to be filled in to make the description work. For instance: what notes should the ogon drone pipes play? What is their timbre like? Bagpipes typically have a very fixed scale (they can only play a few different notes) and from later in the description of The Tressed Silk I got some clues to what kind of scale these ones would have.

Scales are constructed from twenty-four notes dividing the octave. In quartertones, their spacing is 1xxxxxxxxxxxxxxxxxxxxxxxO, where 1 is the tonic, O marks the octave, and x marks other notes. The tonic note is a fixed tone passed from teacher to student.

The alak hexatonic scale is constructed by selection of degrees from the fundamental scale. The degrees selected are the 1st, the 5th, the 8th, the 13th, the 17th, and the 21st.

So it's quarter-tones, but if you look carefully at the notes actually used, only one of them actually needs a quarter-tone accidental to play. I decided to call the tonic note C (for best compatibility with our world's music) and to make it 256Hz. That is "scientific" pitch rather than concert pitch; it makes frequency calculations easier and suits my feeling that the dwarves wouldn't just randomly happen to use our concert pitch. For reference, assigning C = 256Hz and assuming equal temperament (which I do, as it seems the most reasonable thing to do with a quarter-tone scale) puts A above middle C at 430.5Hz.

Then the six notes of the scale are just equally spaced through the octave except that the third note is a quarter-tone flat: C, D, E-half-flat, F#, G#, A#. I decided to make the drone notes C and G#, 256.0Hz and 406.4Hz, as an augmented fifth around which I could imagine the dwarves constructing their harmony. Here's the patch.

The MSK 011 Transistor Mixer with its even-harmonic distortion is the heart of this patch. Sawtooth waves from the two oscillators go into the mixer, and so does a slow LFO signal from the MSK 011 Fixed Sine Bank. With all three of those turned up high, the peaks are high enough to make the discrete-transistor circuit clip, and I can adjust the character of the clipping by using the remaining knob on the mixer to shift it so it clips on one side. Then using the AC output of the mixer kills the DC offset. After that it goes through a Coiler VCF to shape the spectrum a bit. Other outputs of the Fixed Sine Bank provide FM for the oscillators and filter, with the MSK 008 Dual VC Octave Switch being used to invert the control voltage, driving the two oscillators in opposite directions.

For the high register of the ogon, the sound is described as "quavering" and "strident." I opted for a simple subtractive patch, which sounds plenty strident enough when pitched into the very high range (starting three and a half octaves above middle C) I infer from the description.  The picture shows the bandpass output on the Coiler being used, but while I was doing the recording I actually ended up switching to high-pass for a sound that better matched what I was imagining.  The output also goes through a Clouds module to add a little bit of spatialization.

One of the challenges for this patch and the associated music is that bagpipes can't articulate notes the way other instruments do; it's possible to obstruct the air flow to start and stop playing for an entire piece, but that can't be done quickly enough for pauses between notes. Everything is legato (which, fortunately, is also a requirement of the Tressed Silk). There are no silences between notes, much less "rests," in bagpipe music. But the Tressed Silk describes rests even if it's all supposed to be played legato.

I debated whether the dwarves of the Towers of Gladness could have developed some kind of technical solution to bagpipe articulation (such as valves built into the instrument) but there's no mention of such a thing in the game text and it seems like a stretch. I did some reading and learned that bagpipe players in our own world use a set of performance practices under which they play very short grace notes at the start of the regular notes to mark the rhythm; that's how articulation is done with bagpipes.

So I decided that that's how the dwarves do it, too. I wrote out some longer grace notes in the music when I composed that, but I also built grace notes into the patch. As shown in the patch image, the gate CV from the MIDI interface goes to an MSK 012 Transistor ADSR module but then instead of controlling a VCA it drives the exponential FM input of the oscillator. With careful adjustments of the FM amount and attack and decay times (sustain level dropped to zero) I get a little frequency blip at the start of every note. There actually is no VCA in this patch - like a set of real bagpipes, the synthesized ogon just plays continuously.

Patching the zarut

The zarut is supposed to be very much like our pipe organ.

The zarut is a large stationary bone musical instrument which uses a leather bellows to pressurize air, ultimately blowing it through any of two hundred eighty-eight glass pipes. The musician directs air through chosen pipes by playing a metal keyboard. The instrument has both single reed and free reed pipes. The instrument has a nearly seven octave range going from a very low to an extremely high pitch. At all pitches, the instrument has a smooth evolving timbre. It has two registers. The low register has a wavering sonorous timber. The high register begins at middle pitch and has a fluid reedy timber.

The zarut always does the main melody and should perform with feeling.

For the zarut high register, I used a very simple subtractive pitch built around the MSK 007 Leapfrog VCF. Just one envelope drives the built-in VCA; there's also some FM applied to both the oscillator and the filter.

For the low register, described as "sonorous," I brought in the Coiler VCF as well, making use of its rectifier input. The patching here is a little complicated, and in fact on my first try I ended up creating an unintended feedback loop - which, although it sounded interesting, was not the sound I ended up going with for the final mix.

The pulse output of the oscillator goes through the Leapfrog filter, and the result goes into one channel of the Doepfer A-138e crossfader (which is one of my all-time picks for underrated Eurorack modules, excluding my own). An inverted copy of that signal is pulled out to feed the rectifier input of the Coiler, while the main input is driven by the oscillator sawtooth. The result is that the Coiler VCF's input consists of strong harmonics from the sawtooth, plus a processed and modified version of the pulse signal (harmonics removed by the Leapfrog, then added back in by the rectifier). These are hoped to interfere in interesting ways. Both filters go through VCAs with separate envelopes and the results go into the crossfader. Making one envelope fast and the other slow gives something like the "evolving" timbre I imagine for the low register of the zarut; "sonorous" comes from adjusting the filters, some reverb, and just the fact that I'm playing very low notes with this patch.

Composition

I should mention before going further that I'm not writing this in the order I created the music. Really, patching, composing, and other tasks were all done all at once and I'm presenting them arranged into the order that makes sense for explanation. That said, the next things to talk about are the musical structure of each piece in the Tressed Silk form, and the rhythms. From there it becomes possible to actually write sheet music for a piece in this form.

The Tressed Silk has the following structure: a passage and an additional passage possibly all repeated.

The first simple passage is voiced by the melody of the zarut and the harmony of the ogon. The passage is to be in whispered undertones. The zarut covers its entire range from the sonorous low register to the reedy high register and each of the ogon stays in the strident high register. This passage features only melodic tones and intervals. The passage should be composed and performed using frequent modulation.

The second simple passage is voiced be the melody of the zarut. The passage is to be in whispered undertones. The zarut stays in the sonorous low register. This passage typically has some sparse chords.

The basic structure of one passage with ogon and zarut and one with just zarut seems clear. Some of the descriptions seem to conflict with each other - such as "frequent modulation," which implies some kind of structure of chords and keys, against "only melodic tones and intervals." There's also some tension between that and the fundamentally fixed-scale nature of the ogon, if we think they are anything like our world's bagpipes. I decided to stick to the six notes of the "alak scale," and shift up and down the scale where in other music I would use chord changes, without worrying too much about actual chords or keys. Bearing in mind that the alak scale is almost exactly six equally-spaced notes in the octave anyway, writing that way should give an effect sort of like key modulation, and I can imagine that it's a language-translation issue and what I'm doing is what the dwarves really mean by those terms anyway. As elsewhere in the project, it's necessary to fill in some missing details from imagination.

The rhythms are harder to deal with.

The ugog rhythm is made from two patterns: the roder and the zustash.

The roder rhythm is a single line with eight beats divided into four bars in a 2-2-2-2 pattern. The beats are named nel (spoken ne) and biban (bi). The beat is stressed as follows:

| x x | x - | x - | - x |

where x is a beat, - is silent, and | indicates a bar.

The zustash rhythm is a single line with eight beats. The beats are named sedil (spoken se), ustos (us), emär (em), izeg (iz), bemóng (be), gost (go), öntag (önt), and tosid (to). The beat is stressed as follows:

| - - X x x x x - |

where X marks an accented beat, x is a beat, - is silent, and | indicates a bar.

So, first of all, it's not clear what it means for the ugog to be "made from" the roder and zustash patterns. Are they played at once in some kind of polyrhythm? Does it alternate between the two? Or what? I decided that it makes sense - and, critically, would result in something more like music I would like to write - to say that the ugog alternates between the two. In our world's notation it is written as four bars of 2/4 time expressing the roder pattern, followed by a single long bar of 8/4 expressing the zustash, and then the whole thing repeating. It's easy to imagine something like that evolving out of a dance (like some similar rhythms in our world) even if the Tressed Silk is not itself thought of as a dance form in the "present day" of the dwarven world.

But the ugog rhythm as described doesn't sound very good, and that's a common problem in Dwarf Fortress music. I've struggled with how to make anything that sounds at all musical with these patterns full of irregular pauses. One idea is that maybe the patterns the game describes are only meant to be those of the main melody and it's understood that there's also a rhythm section marking time on every single beat too. That's how I wrote Blameless Turquoise. Another idea might be that the "beats" described by the game engine are really the onsets of notes: "x -" doesn't really mean a quarter note followed by a quarter rest, or similar, but rather a half note. That allows for notes of different lengths, which are realistic and otherwise apparently not representable in the game, but it also directly contradicts the use of the word "silence" to describe what "-" means.

For the current piece I went with the theory that the game really does mean what it says, silences and all, but only for the zarut. The ogon, which are not capable of playing rests, play throughout, and the dwarves just understand that of course that's what they do because that's the only way it's possible to play an ogon. I also felt free to subdivide the beats in the ugog rhythm to make the result more musical and interesting.

With those considerations in mind, and a few other guesses, reasonable assumptions, and artistic decisions, I wrote some sheet music for an example of the Tressed Silk. Check out the PDF file and Lilypond source code . Note the latter uses a commercial font, which you'll have to comment out if you want to engrave it with the free defaults.

Recording it

I only have enough modular equipment to build one of my patches at a time, and (except for the drone patch) the patches are monophonic. So, not counting other takes I didn't use, this project ended up requiring 11 separate tracks: one for the drones, two for the two ogon, three for the zarut high register (which plays up to three notes simultaneously in my composition), and five for the zarut low register. These had to be combined after recording.

I used Lilypond to generate the MIDI. What ends up in the MIDI file is not exactly what's notated on the sheet music because it's designed to be something I can feed into my modular synth as easily as possible. Scheme code in the Lilypond file (my posted version includes some third-party library code merged into the single file so you don't have to go looking for other files) extracts monophonic voices from the chords, splitting them into separate tracks. I also added a note and a pause before and after each track so that I could having something to sync up the timing.

My MIDI interface is basically a couple of modified Mutable CVpal kits, and the output range is only from 0V, corresponding to MIDI note 36, to 4V for MIDI note 84. The music calls for notes from MIDI note 24 up to 106, the "almost sevan octaves" of the zarut; but there is no one patch that really needs to cover such a wide range. So I applied transpositions in the MIDI generation and undid them by tuning the oscillator accordingly in each patch: the ogon melody tracks are transposed to put MIDI note 60 at 2048Hz (patch plays 3.0 octaves above scientific-pitch MIDI; conversely, notes in the file are transposed 3.0 octaves below what's written in the sheet music); the zarut high register to put note 60 at 724Hz (1.5 octaves above scientific pitch); and the low register 90.5Hz (1.5 octaves below scientific pitch).

Then it was just a matter of recording my 11 tracks, going back and fixing errors, and once I had a set that I liked, putting them together in Audacity and working out the levels. Here's the result. Play it softly for more authentic effect, because the descriptions says it's all in "whispered undertones" (and how that works with bagpipes, I don't know). I think it came out reasonably well. It is not great music by our world's human standards, and there are ways in which it doesn't perfectly match the game description, but I think it's a reasonable interpretation of what dwarven music would really sound like, and that's a fun thing to think about.

[MP3] [FLAC]

As I said last time, I'd be really interested to hear from anyone else who's trying to write music to match the in-game descriptions of the music of Dwarf Fortress. I think it's an interesting compositional exercise - trying to make something that sounds like what we recognize as music, while still obeying the arbitrary and sometimes nonsensical limits that come from the procedural generator.

UPDATE:  Thanks to a user on the Dwarf Fortress Web forum I found this Soundcloud playlist of "Songs of Zavazsil," music apparently performed in a November 2018 orchestral concert in Washington, DC.  In an associated Reddit thread the composer describes it as "music using the in-game procedural music descriptions as guidelines."  Unfortunately, I haven't been able to find any text describing it - in particular, the actual game-generated descriptions they were following.  From listening to the tracks, they sound more like what I'd call "inspired by" game descriptions than attempts to literally follow the game descriptions in every detail.