Hi!
I've been thinking some time ago about creating a dynamic music system to make game music more immersive and to make it respond to what is happening on the screen.
For those who don't know - dynamic music makes the game not only play tracks fro m start to end, but also "recompose" the music live depending on what is happening in the game. If you're silent - the music is silent too, when you're raging - it keeps up with you.
Now, the idea I had was based on a grid of patterns:
dynamic music 01.png (Size: 7.85 KB / Downloads: 145)
The A, B, C, D are parts of the song like intro, verse, chorus, bridge, solo.
The 1, 2, 3, 4 are versions ("V" for short) of different tension and loudness (1 is the most calm, and 4 is the most hectic version.
The song is programmed using the letters. For example a sequence: "ABABCBCDCD".
Game knows what tempo the track is in, and where in the beat grid all the parts are located (A1, A2, A3, A4, B1, B2, B3 etc...) so it can play any part anytime.
Now the game needs to perform some tests like:
- how many enemies are chasing the player?
- how much health and armor he has?
- is he's about to steal a flag?
- is he about to return a flag (score)?
- is he going to win the match for his team?
- is he a looser?
Based on the result, the game calculates a number for "tension" ("T" for short).
T should be in range between 0 and 1 (a fraction).
The T is being mapped for music versions (if the track has 4 versions we map the T factor from 1 to 4).
Now the game can switch between the parts hard way, once the T*V gets above certain level, the game waits until current top part ends and drops in another version of next part on the playlist.
Or it can mix the parts together, to make the transisions smoother performing cross-fades, but I haven't figured that out yet, and it will be harded to make.
The audio system should have two "decks" - and use it just like a DJ.
At the beginning it drops the first part in the current V (probably 1 at the beginning)on the first deck, and when the first part ends, it will start next one on the second deck, letting the first one end with a natural reverb/delay tails etc.
This way we have a fluent, natural sound with no strange cuts, and no seams.
I've got a simple audio file with A1, A2, A3, B1, B2, B3 parts:
http://unfamusic.com/5h1+/unfa-IME.ogg
The tempo is 110 BPM, meter is 4/4.
Every part lasts 8 bars:
first 4 bars are actual music and second 4 bars are the fadeout, that needs to be mixed for natural sound, but the next part needs to be played every 4 bars.
The song structure is simply "AABB".
I've tried to implement this system with Python, but I coudn't find out the way to play audio :/
Is there anybody who'd like to code a simple version of this algorithm using my composition?
PS: This is my 1,000th post! Yay!
I've been thinking some time ago about creating a dynamic music system to make game music more immersive and to make it respond to what is happening on the screen.
For those who don't know - dynamic music makes the game not only play tracks fro m start to end, but also "recompose" the music live depending on what is happening in the game. If you're silent - the music is silent too, when you're raging - it keeps up with you.
Now, the idea I had was based on a grid of patterns:
dynamic music 01.png (Size: 7.85 KB / Downloads: 145)
The A, B, C, D are parts of the song like intro, verse, chorus, bridge, solo.
The 1, 2, 3, 4 are versions ("V" for short) of different tension and loudness (1 is the most calm, and 4 is the most hectic version.
The song is programmed using the letters. For example a sequence: "ABABCBCDCD".
Game knows what tempo the track is in, and where in the beat grid all the parts are located (A1, A2, A3, A4, B1, B2, B3 etc...) so it can play any part anytime.
Now the game needs to perform some tests like:
- how many enemies are chasing the player?
- how much health and armor he has?
- is he's about to steal a flag?
- is he about to return a flag (score)?
- is he going to win the match for his team?
- is he a looser?
Based on the result, the game calculates a number for "tension" ("T" for short).
T should be in range between 0 and 1 (a fraction).
The T is being mapped for music versions (if the track has 4 versions we map the T factor from 1 to 4).
Now the game can switch between the parts hard way, once the T*V gets above certain level, the game waits until current top part ends and drops in another version of next part on the playlist.
Or it can mix the parts together, to make the transisions smoother performing cross-fades, but I haven't figured that out yet, and it will be harded to make.
The audio system should have two "decks" - and use it just like a DJ.
At the beginning it drops the first part in the current V (probably 1 at the beginning)on the first deck, and when the first part ends, it will start next one on the second deck, letting the first one end with a natural reverb/delay tails etc.
This way we have a fluent, natural sound with no strange cuts, and no seams.
I've got a simple audio file with A1, A2, A3, B1, B2, B3 parts:
http://unfamusic.com/5h1+/unfa-IME.ogg
The tempo is 110 BPM, meter is 4/4.
Every part lasts 8 bars:
first 4 bars are actual music and second 4 bars are the fadeout, that needs to be mixed for natural sound, but the next part needs to be played every 4 bars.
The song structure is simply "AABB".
I've tried to implement this system with Python, but I coudn't find out the way to play audio :/
Is there anybody who'd like to code a simple version of this algorithm using my composition?
PS: This is my 1,000th post! Yay!
I'm making Liblast - a FOSS online FPS game made with Godot 4 and a 100% open-source toolchain