{"author_link":"\/users\/fonserbc","author_name":"fonserbc","author_uid":"fonserbc","comments":[],"epoch":1557331516,"event":"LD44","format":"md","ldjam_node_id":157076,"likes":26,"metadata":{"p_key":"132589","p_author":"fonserbc","p_authorkey":"1007518","p_urlkey":"348783","p_title":"Procedural music in Jamsterdam","p_cat":"LDJam ","p_event":"LD44","p_time":"1557331516","p_likes":"26","p_comments":"0","p_status":"WAYBACK","us_key":"1007518","us_name":"fonserbc","us_username":"fonserbc","event_start":"1556236800","event_key":"75","event_name":"LD 44"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD44","removed_author":false},"_superparent":139254,"_trust":2,"author":7518,"body":"![jamsterdam_band.gif](\/\/\/raw\/e5d\/1\/z\/24bc3.gif)\nThis Ludum Dare @notke and I made [Jamsterdam](https:\/\/ldjam.com\/events\/ludum-dare\/44\/jamsterdam), a game about trying to survive being a jazz singer in Amsterdam.\n\nThe game features an endless procedural jazz sountrack that was possible with the musical help from YenTing (@tinglo2233)\n\nIn 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!\nI'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 [AudioSource](https:\/\/docs.unity3d.com\/ScriptReference\/AudioSource.html)s and messing with the pitch to change the frequency (the note) of our audio clips.\n\nDisclaimer: Some of the details refer *only* to the post-jam version of the game.\n\nWe aimed to create a jazz rhythm section that play a nice-sounding ac*comp*aintment 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***\n\n# Endless chord progression\n\nWe 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](https:\/\/en.wikipedia.org\/wiki\/Ii%E2%80%93V%E2%80%93I_progression)\n\n![Captura de pantalla 2019-05-08 15.31.14.png](\/\/\/raw\/e5d\/1\/z\/24bcb.png)\n\nWe 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.\nAfter some testing, we were satisfied with the simplicity and how effective it was.\nWe then only have these 3 chords:\n* **IIm7** Second minor seven\n* **V7** Fifth dominant seven\n* **Imaj7** First major seven\n\nThis means, if the song is in C major key, the chords played are going to be:\n\n**Dm7** :arrow_right: **G7** :arrow_right: **Cmaj7**\n\nThen after a two-five-one has been played we need to decide the next tonality to modulate to.\nIn 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:\n\n* 30% Stay in the same key\n* 30% Modulate a whole tone down\n* 40% Modulate to _any_ other key\n\nA new key is then chosen and its corresponding two-five-one are queued in the chord progression\n\n# Vocal Solo\n\nFor 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*.\nWe 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.\n\nThe 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.\n\nTo find the right amount of *pitch* distortion to apply to a clip (using Unity's [AudioSource.pitch](https:\/\/docs.unity3d.com\/ScriptReference\/AudioSource-pitch.html)) to hit the right note you can use the formula:\n```\nn0 = note of the recorded clip\nn = note you want the clip to sound\ndeltaSemitones = n - n0 \/\/ number of semitones appart\npitchN = 2 ^ (deltaSemitones\/12) \/\/ pitch value to apply to the AudioSource\n```\nIf you want to learn more check the [physics of music by Bryan H. Suits](https:\/\/pages.mtu.edu\/~suits\/NoteFreqCalcs.html)\n\nIn 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.\n\n# The comping instruments\n### Drums\n![drums.gif](\/\/\/raw\/e5d\/1\/z\/24bce.gif)\n*(Please pretend the cymbal is a hi-hat)*\n\nWe knew from the very beginning we needed at least a double bass and some kind of drums.\nWe went for a very minimalistic (and simplistic) representation of the drummer: Hi-Hat only [jazz swing](https:\/\/en.wikipedia.org\/wiki\/Swing_(jazz_performance_style)).\nIt 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:\n\n### Double bass\n![doublebass.gif](\/\/\/raw\/e5d\/1\/z\/24bd0.gif)\n\nFor the double bass we tried to imitate a [walking-bass](https:\/\/en.wikipedia.org\/wiki\/Bassline#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:\n\nIn a Fm7 Chord:\n* Play F in the first beat\n* Play randomly F, Ab, C or Eb on the other beats\n\nAgain, I want to emphasize, this is a very simplistic imitation of a real player :grin:\n\n### Piano\n\n![piano.gif](\/\/\/raw\/e5d\/1\/z\/24bd1.gif)\n\nOriginally 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.\n\nThey 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).\n\nWe managed to add 2 different [voicings](https:\/\/en.wikipedia.org\/wiki\/Voicing_%28music%29) for the keyboard.\n* **Basic voicing**\nWe 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.\n* **Tonic-less voicing**\nSince 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:\n> II :arrow_right: 7 3 5 9\n>\n> V :arrow_right: 3 7 9 13\n>\n> I :arrow_right: 7 3 5 9\n\nOn each key change, the keyboard player chooses a voicing to perform.\n\n# Wrapping up\n\nThere 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..\nBut we are very happy with the overall result of both the visual landscape and the soundscape of the music.\n\nWe 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: \n\nGive Jamsterdam a try and check the post-jam version on itch.io:\n\nhttps:\/\/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)*\n\nBig shoutout to @notke's amazing visual adaptation of Amsterdam :art: :cityscape: Check his work on twitter [Nothke](https:\/\/twitter.com\/Nothke)\n\nFollow @tinglo2233 for amazing music :microphone: :musical_score: \n\nFollow me for more games that make music :video_game: :musical_note: \n\n","comments":1,"comments-timestamp":"2019-05-08T20:26:05Z","created":"2019-05-08T12:23:14Z","files":[],"files-timestamp":0,"id":157076,"love":26,"love-timestamp":"2019-05-09T15:14:43Z","meta":[],"modified":"2019-05-09T15:14:43Z","name":"Procedural music in Jamsterdam","node-timestamp":"2019-05-08T16:18:07Z","parent":153376,"parents":[1,5,9,139254,153376],"path":"\/events\/ludum-dare\/44\/jamsterdam\/procedural-music-in-jamsterdam","published":"2019-05-08T16:05:16Z","scope":"public","slug":"procedural-music-in-jamsterdam","subsubtype":"","subtype":"","type":"post","version":473602},"node_metadata":{"n_key":"157076","n_urlkey":"348783","n_parent":"153376","n_path":"\/events\/ludum-dare\/44\/jamsterdam\/procedural-music-in-jamsterdam","n_slug":"procedural-music-in-jamsterdam","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"7518","n_created":"1557318194","n_modified":"1557414883","n_version":"473602","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/44\/jamsterdam\/procedural-music-in-jamsterdam","text":"![jamsterdam_band.gif](\/\/\/raw\/e5d\/1\/z\/24bc3.gif)\nThis Ludum Dare @notke and I made [Jamsterdam](https:\/\/ldjam.com\/events\/ludum-dare\/44\/jamsterdam), a game about trying to survive being a jazz singer in Amsterdam.\n\nThe game features an endless procedural jazz sountrack that was possible with the musical help from YenTing (@tinglo2233)\n\nIn 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!\nI'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 [AudioSource](https:\/\/docs.unity3d.com\/ScriptReference\/AudioSource.html)s and messing with the pitch to change the frequency (the note) of our audio clips.\n\nDisclaimer: Some of the details refer *only* to the post-jam version of the game.\n\nWe aimed to create a jazz rhythm section that play a nice-sounding ac*comp*aintment 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***\n\n# Endless chord progression\n\nWe 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](https:\/\/en.wikipedia.org\/wiki\/Ii%E2%80%93V%E2%80%93I_progression)\n\n![Captura de pantalla 2019-05-08 15.31.14.png](\/\/\/raw\/e5d\/1\/z\/24bcb.png)\n\nWe 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.\nAfter some testing, we were satisfied with the simplicity and how effective it was.\nWe then only have these 3 chords:\n* **IIm7** Second minor seven\n* **V7** Fifth dominant seven\n* **Imaj7** First major seven\n\nThis means, if the song is in C major key, the chords played are going to be:\n\n**Dm7** :arrow_right: **G7** :arrow_right: **Cmaj7**\n\nThen after a two-five-one has been played we need to decide the next tonality to modulate to.\nIn 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:\n\n* 30% Stay in the same key\n* 30% Modulate a whole tone down\n* 40% Modulate to _any_ other key\n\nA new key is then chosen and its corresponding two-five-one are queued in the chord progression\n\n# Vocal Solo\n\nFor 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*.\nWe 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.\n\nThe 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.\n\nTo find the right amount of *pitch* distortion to apply to a clip (using Unity's [AudioSource.pitch](https:\/\/docs.unity3d.com\/ScriptReference\/AudioSource-pitch.html)) to hit the right note you can use the formula:\n```\nn0 = note of the recorded clip\nn = note you want the clip to sound\ndeltaSemitones = n - n0 \/\/ number of semitones appart\npitchN = 2 ^ (deltaSemitones\/12) \/\/ pitch value to apply to the AudioSource\n```\nIf you want to learn more check the [physics of music by Bryan H. Suits](https:\/\/pages.mtu.edu\/~suits\/NoteFreqCalcs.html)\n\nIn 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.\n\n# The comping instruments\n### Drums\n![drums.gif](\/\/\/raw\/e5d\/1\/z\/24bce.gif)\n*(Please pretend the cymbal is a hi-hat)*\n\nWe knew from the very beginning we needed at least a double bass and some kind of drums.\nWe went for a very minimalistic (and simplistic) representation of the drummer: Hi-Hat only [jazz swing](https:\/\/en.wikipedia.org\/wiki\/Swing_(jazz_performance_style)).\nIt 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:\n\n### Double bass\n![doublebass.gif](\/\/\/raw\/e5d\/1\/z\/24bd0.gif)\n\nFor the double bass we tried to imitate a [walking-bass](https:\/\/en.wikipedia.org\/wiki\/Bassline#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:\n\nIn a Fm7 Chord:\n* Play F in the first beat\n* Play randomly F, Ab, C or Eb on the other beats\n\nAgain, I want to emphasize, this is a very simplistic imitation of a real player :grin:\n\n### Piano\n\n![piano.gif](\/\/\/raw\/e5d\/1\/z\/24bd1.gif)\n\nOriginally 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.\n\nThey 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).\n\nWe managed to add 2 different [voicings](https:\/\/en.wikipedia.org\/wiki\/Voicing_%28music%29) for the keyboard.\n* **Basic voicing**\nWe 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.\n* **Tonic-less voicing**\nSince 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:\n> II :arrow_right: 7 3 5 9\n>\n> V :arrow_right: 3 7 9 13\n>\n> I :arrow_right: 7 3 5 9\n\nOn each key change, the keyboard player chooses a voicing to perform.\n\n# Wrapping up\n\nThere 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..\nBut we are very happy with the overall result of both the visual landscape and the soundscape of the music.\n\nWe 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: \n\nGive Jamsterdam a try and check the post-jam version on itch.io:\n\nhttps:\/\/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)*\n\nBig shoutout to @notke's amazing visual adaptation of Amsterdam :art: :cityscape: Check his work on twitter [Nothke](https:\/\/twitter.com\/Nothke)\n\nFollow @tinglo2233 for amazing music :microphone: :musical_score: \n\nFollow me for more games that make music :video_game: :musical_note: \n\n","title":"Procedural music in Jamsterdam","wayback_source":[]}