[Tutorial] Custom Ambient Music Serverside


OpenDayZ Rockstar!
So, can we all agree that the normal ambient music in dayz sucks? All of these tracks here?

The first time you hear that screeching grinding metal noise in game, you almost crap yourself, and then go into the settings to turn music off. Most people never turn it back on afterwards for any reason. This makes adding things like server intro music pointless if no one will be able to hear it without first turning their music back up.​
So how can we start to make this better? I want to try to get as many servers as possible to start disabling rocket's ambient music so we can actually start playing with our music turned up.​
To do this, you make a custom compiles (copied from your client) and simply comment out this line after adding it to your mission.pbo by putting a double slash in front of it.​
player_music =                compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf";
But why should we stop there when we can add our own custom ambient music! No more smothering the map in triggers to add your own custom ambient sounds, just have them play dynamically for everyone!​
Instead of commenting out that line, include a custom player_music.sqf in your mission file.​
Use the script below. I've made it really simple.​
private ["_sound","_length","_pause","_enableAmbient","_minWaitTime","_maxWaitTime","_musicArray","_waitTimeDifference","_randomWait"];
//// Vampire's Better Ambient Music v1 //////
// Enable Ambient music? true/false
_enableAmbient = true;
while {!r_player_dead && _enableAmbient} do {
        // Minimum amount of time before running the next track (in seconds)
        // Default for my script is 10 minutes. (600 seconds)
        // Must be less than the maximum wait time.
        _minWaitTime = 600;
        // Maximum amount of time before running the next track (in seconds)
        // Default for my script is 30 minutes. (1800 seconds)
        // Must be more than the maximum wait time.
        _maxWaitTime = 1800;
        // The array of your ambient tracks. These must match the class of a
        // cfgMusic entry either in the default DayZ cfgMusic or Description.ext
        // In your Mission.pbo. (Example: class bombs)
        // It will choose a random track from this array.
        _musicArray = ["alarm", "bombs", "gunfire","wind"];
        // Pick a sound
        _sound = _musicArray select floor random count _musicArray;
        // Get it's length from the cfgMusic/Description.ext
        _length = getNumber(configFile >> "cfgMusic" >> _sound >> "Duration");
        // Lets figure out the random wait time
        _waitTimeDifference = ((_maxWaitTime) - (_minWaitTime));
        _randomWait = (random (_waitTimeDifference));
        _pause = (_randomWait) + (_length);
        // Play the song
        if (!r_player_unconscious and !r_pitchWhine) then {
            playMusic _sound;
        // Let the script sleep the song length and the random amount of time
        sleep _pause;
Then you need to define your new tracks in your description.ext like this.
class CfgMusic
    class bombs
        name = "bombs";
        sound[] = {"Ambience\bombs.ogg", db+0, 1.0};
        duration = 13;
    class etc
        name = "etc";
        sound[] = {"Ambience\etc.ogg", db+0, 1.0};
        duration = 5;
You need to put the class names in the player_music.sqf music array.
The sound files also have to be .ogg files like any arma 2 sounds.
The duration is the length of the track in seconds. This needs to be correct.
For neatness I put all of my tracks in a folder in the mission.pbo called "Ambience", but you can put them where you like.
The length and size of your ambient tracks are only limited by how big you want to make your mission file, but the size grows fast.

Hopefully we can get some servers going that have some awesome custom ambient music instead of the default and actually give our music sliders some use!

I've added 4 ambient tracks to my server, so if you want to see these in action, turn your music slider up, and play around on my Epoch server for a little while.
I like it actually mate, though the one problem I'm having is an conversion to ogg files.. I'm guessing my search-fu is off today.. only a couple of hours sleep will do that,, serves me right



OpenDayZ Rockstar!
Well I havn't actually ran the script I posted, I just threw it together...

I have a more botched together version on my server atm.
I'll use the script I posted and see if its working.


OpenDayZ Rockstar!
Only issue now is that JIPs aren't on the same music loop as other players.

If someone who knows what they are doing can modify it to send PublicVariables, that would be great.


Valued Member!
can confirm the .hpp way works aswell.
instead of messing with your description.ext.

you can add at he bottom : #include "custom\Ambience\music.hpp"

Then you can call the tracks from the music.hpp



Valued Member!
Just thinking out load here,

is is possible to stream music from various sources ???

for example have a radio list on the mouse scroll, then select.
[not at home so cant test the theory out.]


OpenDayZ Rockstar!
I havn't tested if you can play a music file that is an Ogg Vorbis stream.
It should in theory work, but haven't tested like I said.


OpenDayZ Rockstar!
The only issue I have for Epoch is that the safe login GUI is LOUD beeping noises.

Unfortunately the safegui is pointed to from the config.cpp and so is the sounds, so there's not a fix for it unless they call the GUI from a different location in a future version.

If someone wants to post on dayzepoch recommending they remove them that would be great.
Hi, i do all, what you write, but Im not hear dayz and my ambients, in Namalsk, ambients have 4-6 mb, i use namalsk and my track, but no hear in game, what's wrong?
i try make it on Dayz Epoch