Jump to content
  • 0

Dynamic Music


Lowy-♥

Question

I am personally SO MUCH into dynamic music, or just music in general in videogames, all the mods that i did for other games (Payday 2, DOOM Eternal, Devil May Cry 5, etc) where only about dynamic music.

 

rn i am working on a doom map, that would be my 2nd map (+ other 2 maps that i discarded because of quiting for a long time), the first one was mostly like a fast test, so i was kinda struggling with if:

 

  1. i should just put midi music of a band that i really like
  2. do that but with a OGG file, which the bad part was that it would loss some of the aesthetic of the game, but it would be so much easy at the moment of looping and selecting a song
  3. find a way to make an actual dynamic music mod only for 1 MAP WAD, which sounds like a lot of work just for that lol

 

so i am very ambitious with this stuff, and i have a lot of ideas going trough my head when is about music, like playing a part for the intro of the level, then it starts playing a loop combat when the player past trough a pre-defined linedef.

or maybe make a calm loop and a combat loop.

or also a part when a combat with a boss starts, and what if i want a segment also for a secrect boss??

 

 

well... the actual question is: where should i start this madness?:

  • I only worked a little with ZDoom ACS Scripting (the UDB Script Editor), so if i can do any of this just with that (and also a little of SLADE for the OGG files) it shouln't be that hard ig?
  • i saw that there is some of these type of mods, like the one by cyber_cool (the most popular one) yet i really dont like this one for a lot of reasons, like the fade out and in of the tracks, and is also very limited (For my needs), i need a very especific thing for my own stuff/maps, so idk if i should start basing myself on it, because i know there is probably better examples of this stuff on some wads, but would be hard to find for me because thats made for spesific stuff

 

i just really think the music is a BIG part of the feeling of the experience of EVERYTHING, so, yeah, very important, for me at least

 

PD: Sorry for the (probably) big amount of misspellings

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

First, if you're going down this route, you're probably best with UDMF and GZDoom. The more vanilla formats won't support scripting and vanilla engines are unlikely to be happy either. But hey, that gives you a lot of power.

 

You can include any number of music tracks in your map, and GZDoom is able to play many kinds (MP3, OGG, WAV, FLAC, MIDI and a number of more obscure formats). MP3/OGG is usually fine for most purposes, and MIDI files are both smaller (good for community projects or if you're trying to reduce file size for other reasons) and feel more "Doomy". The infamous MyHouse.WAD used both MP3/OGG and MIDI formats, the latter for its extended D_RUNNIN track and the former for the more ambient weirdness.

 

You can specify which music track you want to play on starting the map in your MAPINFO file. If you don't want ANY music on starting, just include a short (few seconds) silent music file. Call it SILENT.MP3 or whatever. Doom is happy to play a two second loop of silence as a music track.

 

ACS scripts can then be used to change the music whenever triggered - line actions, monster deaths, button presses, even just walking into a sector with an ActorEntersSector object - with the SetMusic("name") command. This can be pretty jarring, however, so you may want to fade music in and out with the SetMusicVolume() command. I wrote a fade script for a previous map that would fade out the current music and then fade in a new track based on a parameter passed to it, but note that you can't pass strings as parameters to ACS scripts, so if you want to parameterise a music fade script you'll need a lookup table for your track names.

 

script "CrossfadeMusic" (int NewTrack)
{//Switch from currently playing music to new track specified.
	int musicVolume = 1.0;
	while(musicVolume > 0)
    {
        musicVolume -= 0.05;
        SetMusicVolume(musicVolume);
        Delay(1);
    }
    SetMusic(MusicTable[NewTrack]); // MusicTable is an array of strings that holds my track names. NewTrack is the index for the next track.
    while(musicVolume < 1.0)
    {
        musicVolume += 0.05;
        SetMusicVolume(musicVolume);
        Delay(1);
    }
}

 

The other thing you can do is use PlaySound to create more dynamic music - playing small snippets of music as sound effects based on scripted events, possibly using delays to time them, would be more complicated to pull off... but it could sound quite impressive. You could, for instance, play a sequence of drums in a script when you spring your monster trap and loop that script until the monsters in the trap are all dead, and you could make the delay between the drum loops based on player health, so they get faster the closer you are to death.

Edited by Artinum

Share this post


Link to post
  • 0

GZDoom doesn't have a ton of fancy music-related features, but it does have a SetMusic ACS function that's pretty straightforward to use. If all you're wanting to do is change the music when you cross a line, toss it in a script and throw ACS_Execute on the line, and you'll be good to go. If you need to do something more complex than that, it's still a good starting point at least.

Share this post


Link to post
  • 0
Posted (edited)
5 hours ago, Artinum said:

ACS scripts can then be used to change the music whenever triggered - line actions, monster deaths, button presses, even just walking into a sector with an ActorEntersSector object - with the SetMusic("name") command. This can be pretty jarring, however, so you may want to fade music in and out with the SetMusicVolume() command.

yeah i was already doing this lol, it stills being very very limited, and also bugy, there is a lot of cuts all the time when it changes of music fragment
(From Ingame audio recording)

 

5 hours ago, Artinum said:

I wrote a fade script for a previous map that would fade out the current music and then fade in a new track based on a parameter passed to it, but note that you can't pass strings as parameters to ACS scripts, so if you want to parameterise a music fade script you'll need a lookup table for your track names.

Meh, i did something similar based on how close the player is from something

script 1000 (int musicFade1, int musicFade2, int musicFade3, int musicFade4)

{
    if(musicFade1 < 1)
    {
        musicFade1 = 0.80;
        SetMusicVolume(musicFade1);
    }

	if(musicFade2 < 1)
    {
        musicFade2 = 0.60;
        SetMusicVolume(musicFade2);
    }

	if(musicFade3 < 1)
    {
        musicFade3 = 0.40;
        SetMusicVolume(musicFade3);
    }

	if(musicFade4 < 1 && musicFade1 == 2 && musicFade2 == 2 && musicFade3 == 2)
    {
        musicFade4 = 0.20;
        SetMusicVolume(musicFade4);
    }

}

 

5 hours ago, Artinum said:

The other thing you can do is use PlaySound to create more dynamic music - playing small snippets of music as sound effects based on scripted events, possibly using delays to time them, would be more complicated to pull off... but it could sound quite impressive. You could, for instance, play a sequence of drums in a script when you spring your monster trap and loop that script until the monsters in the trap are all dead, and you could make the delay between the drum loops based on player health, so they get faster the closer you are to death.

the thing with this is that i would have to make my own soundtrack or something like that, which would be to much for me because i suck at music, but i am good at editing it, ig i could try with some songs

 

Pd: the attachments are always bugged on my post and for some reasons even if i delete them they stills stay at the bottom of the post

image.png

image.png

image.png

Edited by Lowy-♥

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...