This Ludum Dare @notke and I made Jamsterdam, a game about trying to survive being a jazz singer in Amsterdam.
The game features an endless procedural jazz sountrack that was possible with the musical help from YenTing (@tinglo2233)
In this post, I'm going to go into the musical details that made this possible, forgive me if I'm too technical but I hope you can enjoy the explanation too!
I'm no professional musician but I have the required musical knowledge to communicate with YenTing and make this happen. We made everything inside Unity, using multiple AudioSources and messing with the pitch to change the frequency (the note) of our audio clips.
Disclaimer: Some of the details refer only to the post-jam version of the game.
We aimed to create a jazz rhythm section that play a nice-sounding accompaintment for the player (the singer) as you improvise your scatting solo. For this purpose, we needed to compose a song, a base for you to improvise on, and already on the conception of the idea we decided to go procedural
Endless chord progression
We wanted a song that sounded like jazz, so after discussing with YenTing we went for one of the most characteristic jazz progressions: Two-Five-One progression

We stuck to a major tonality for simplicity and lack of time, but basically that means that the whole sountrack keeps repeating the chords 2, 5 and 1 (for 2 bars) over and over, with some modulation in between, which I'm going to explain.
After some testing, we were satisfied with the simplicity and how effective it was.
We then only have these 3 chords:
* IIm7 Second minor seven
* V7 Fifth dominant seven
* Imaj7 First major seven
This means, if the song is in C major key, the chords played are going to be:
Dm7 :arrowright: G7 :arrowright: Cmaj7
Then after a two-five-one has been played we need to decide the next tonality to modulate to.
In Jazz, your modulations are not really limited, you can change the key to any other, and the song can still make sense and sound good, but there are still some common transitions. For the sake of time, in our case we only defined 3 different transitions and assigned them different probabilities:
- 30% Stay in the same key
- 30% Modulate a whole tone down
- 40% Modulate to any other key
A new key is then chosen and its corresponding two-five-one are queued in the chord progression
Vocal Solo
For the singer we are using just a 10 audio samples of YenTing singing a C4 using different syllables. In our case we have: Ba Be Bi Bo Bu Ta Te Ti To Tu.
We randomly choose a syllable whenever the player presses the mouse, and we could easily increase the vocabulary of the singer by increasing the number of samples.
The sample is then pitched to a note in the scale of the current key. This scale is constant during the duration of a 2-5-1, and it's always a major scale.
To find the right amount of pitch distortion to apply to a clip (using Unity's AudioSource.pitch) to hit the right note you can use the formula:
n0 = note of the recorded clip
n = note you want the clip to sound
deltaSemitones = n - n0 // number of semitones appart
pitchN = 2 ^ (deltaSemitones/12) // pitch value to apply to the AudioSource
If you want to learn more check the physics of music by Bryan H. Suits
In the game, we define a singing range and map the vertical position of the mouse on screen to the a note in the range of the singer. We always make sure the mapped note is on the scale of the song on that moment.
The comping instruments
Drums
(Please pretend the cymbal is a hi-hat)
We knew from the very beginning we needed at least a double bass and some kind of drums.
We went for a very minimalistic (and simplistic) representation of the drummer: Hi-Hat only jazz swing).
It doesn't do fair to all the ways a drummer can play but please, if you are a drummer, forgive our lack of time :sweat_smile:
Double bass

For the double bass we tried to imitate a walking-bass. At the begining of each bar, if we just changed chord, the bass plays the tonic of that chord, and in the subsequent beats, the bass plays notes in the chord of the song of that moment. For example:
In a Fm7 Chord:
* Play F in the first beat
* Play randomly F, Ab, C or Eb on the other beats
Again, I want to emphasize, this is a very simplistic imitation of a real player :grin:
Piano

Originally we tried to stick with only bass and drums, but we very soon realized we lacked more support on the harmony of the chord in order for the vocal solos to sound good, so we decided to go for a simple piano comper.
They keyboard player plays each new chord on its first beat, plus on the Imaj7 chords (which are 2 bars long) it plays on 5-and and 6-and (that means on the last third of both the 5th and the 6th beat).
We managed to add 2 different voicings for the keyboard.
* Basic voicing
We just play the chord notes from lower to higher. In a G7 chord, the piano will play G B D F, the G being the lowest note and the F the highest.
* Tonic-less voicing
Since the doublebass is already playing the base note of each chord, the keyboard can avoid it. YenTing wrote down for us a common 2-5-1 voicing for jazz piano players. From lower to higher note, for each chord of the 2-5-1 progression:
II :arrow_right: 7 3 5 9
V :arrow_right: 3 7 9 13
I :arrow_right: 7 3 5 9
On each key change, the keyboard player chooses a voicing to perform.
Wrapping up
There are plenty things we wanted to do with the music but didn't have time for in the end: Adding other chord progressions, modulating to minor modes, improving the sound and variety of the instruments..
But we are very happy with the overall result of both the visual landscape and the soundscape of the music.
We wanted to make the player feel like they are jazz singers singing in the canals of Amsterdam, to make players feel like they are improvising with a live jazz-band, and I feel we got quite close to that feeling :slight_smile:
Give Jamsterdam a try and check the post-jam version on itch.io:
https://nothke.itch.io/jamsterdam (If you press X 3 times you can enable the Chill-mode where you can just enjoy the scenery and sing freely without the worring about paying the bills)
Big shoutout to @notke's amazing visual adaptation of Amsterdam :art: :cityscape: Check his work on twitter Nothke
Follow @tinglo2233 for amazing music :microphone: :musical_score:
Follow me for more games that make music :videogame: :musicalnote: