In this tutorial (sorta ) I will tell you how to implement Dynamic music in Ren'Py!
You will see the following:
1- What is Dynamic music?
2- Kinds of Dynamic music.
3- Are there any games that use Dynamic music?
4- How to do this?
5- Disclaimer (important)
- First: Definition.
According to wikipedia.In video games, adaptive music (also called dynamic or interactive music) is background music whose volume, rhythm or tune changes in response to specific events in the game.
- Second: Types of Dynamic music.
It's not really "kinds" as I am labeling them based on what I hear.
A - Static & ....Dynamic?
Music in this section change from a part of a song to the beginning of another (the first song is finished like 50 % but when the other one starts it always plays from the start!)
B- DYNAMIC!
Music in this section change from a part of a song to the same part of another song!
This is the part that I will be covering!
- Third: Examples.
A lot of AAA games use Dynamic music, especially fast-paced and/or hack & slash games.
The most famous for manipulating this are:
- Doom 2016, Check this video:
https://www.youtube.com/watch?v=72S2aAxtZOs
(The first two minutes)
You will notice that when Doomguy (player) engages in fights, the metal-themed music gets harder and harder!
- Devil May Cry 5, Check this video:
https://www.youtube.com/watch?v=9gTMISeq4lE
(The entire video, you can skip)
The music is quiet when your rank (combo) is low, but it gets harder when your rank increases!
Both DMC5 and Doom use type A of Dmusic.
- Fourth: INM
The part you all have came for
I will first explain in a really concise form and then I will dive into the dirty work (it's easy, don't worry)!
- Short (no coding):
You need to have 2 "music" channels and then you play the two songs that will "interfere", let's call them "INM" (interfering music)
You'll then adjust INM so one of them has maximum volume (or whatever percentage you want except, obviously, 0)
and you'll want to make the other one 0
When the "action" or the "hype" part comes you'll want to switch the volume between INM.
- The not-short (not long, too!):
1- Register the 2nd "music" channel by typing this:You can change *yourmusic_channel* to anything you want, I personally use "music2", you can see that in the attached project.Code: Select all
init python: renpy.music.register_channel("yourmusic_channel", "music")
2- Play the INM by typing this:3- Adjust the INM volumes by typing:Code: Select all
play music "1stmusic" play music2 "2ndmusic"
I set the interfering channel to 0 (Because when it interferes, its volume will increase)Code: Select all
$ renpy.music.set_volume(1, channel='music') $ renpy.music.set_volume(0, channel='yourmusic_channel')
And I set the other one to any volume but 0 (This code doesn't affect the music slider in Preferences, so if you set it to 1/100%, you can still lower the music to 50% in Preferences, for example.)
4- Add something that tells you that the music will change (optional)
I use this in the attached project:
"The music will change after you click now."
5- Switch the volume between the INM by typing:You have to set the channel that was not 0 volume to 0.Code: Select all
$ renpy.music.set_volume(0, channel='music') $ renpy.music.set_volume(1, channel='yourmusic_channel')
NOTE: You can put the channel that was 0 volume to anything to your liking. (Maybe you want the first song loud but you want the new one softer?Idk)
6- The final code should look something like:Code: Select all
init python: renpy.music.register_channel("yourmusic_channel", "music") label start: play music "1stmusic" play music2 "2ndmusic" $ renpy.music.set_volume(1, channel='music') $ renpy.music.set_volume(0, channel='yourmusic_channel') "The music will change after you click now." $ renpy.music.set_volume(0, channel='music') $ renpy.music.set_volume(1, channel='yourmusic_channel')
- Fifth: Disclaimer.
You can use the project and codes however you want EXCEPT for the music which are used for demonstration, please refrain from using them.
I do not own any of these:
1- Resident Evil 1 Save Room theme
2- Resident Evil 1 Remastered Save Room theme
3- Resident Evil 2 Hunk DLC theme
4- The Evil Within - Save Room theme (Claire De Lune)
5- Claire De Lune (Original)
I know it's not fair to mention examples (Doom and DMC5) that won't be covered in this tutorial but I don't think it is necessary to include them as that requires the basic of music changing (play music, stop music) which heavily depends on the music itself rather than the methodology of changing music, lmao idk if this makes sense
The music in my project are cut manually by me, I know the cuts are not perfect but I was hoping it does the job, especially Claire De Lune X The Evil Within.
I am thinking of adding some sort of fade-in, maybe another day.
Thank you for reading!