Music

By Hoz

Adding pieces of music to your mission can really influence the atmosphere for the player, it can really assist in helping build suspense, or compliment intro's and cutscenes. Having the right piece of music for the situation at hand can really demonstrate a mission builders experience and attention to detail.

Preparing the music score

Choosing a piece of music is a pretty simple task, you want to choose a score of music that is going to fit your purpose. 

In the included example, I've choose a two minute piece out of a five minute take.  I have faded the start and the ending so that it integrates nicely into the mission. I have converted the mp3 file to a .ogg file named file0036.ogg. Maybe I should have made clip shorter considering I used this example in a multiplayer and music/sounds really can bloat the mission.pbo file.

Adding the music to your mission

Your going to need a music file, if you don't have one then head on over to OFPEC's Sound Library and see if there is one that suits your needs. 

You will need to start with a simple mission. Add a unit to the mission and save the mission as MyMusicTest.

Create a new folder within the mission structure called sound or music and plunk your music file into this folder.


Created a file called description.ext,  this is where we have to configure the music so its recognizable by the editor.

class CfgMusic
{
    tracks[]={};
   class JPTrack1
   {
       name = "JohnPilkey_Track1";
       sound[] = {"\sound\file0036.ogg", db+5, 1.0};
    };
};

In this example I'm using just a single class called JPTrack1, if you want to add more simply added a new class after the second last };

 class CfgMusic
{
    tracks[]={};
   class JPTrack1
   {
       name = "JohnPilkey_Track1";
       sound[] = {"\sound\file0036.ogg", db+5, 1.0};
    };

   class JPTrack2
   {
       name = "JohnPilkey_Track1";
       sound[] = {"\sound\file0036.ogg", db+5, 1.0};
    };
};

 

Launching the music at the appropriate time

To use an effects trigger, create a new trigger and click the effects buttom.

 

 Pull down the track menu, and you should see your new entry.

 

Trigger the music via a radio trigger or scripting command.

See the example mission on how I setup to play the music on demand through a radio trigger.

Considerations

  • Remmeber that adding music can add considerable size to your mission.
  • Don't add music where it doesn't fit. For example don't add music just for the sake of adding it. You should have a purpose in mind and it should add to the user expierence.
  • Choose music which isn't copyrighted. 

References

Example mission for this tutorial.

OFP Sound tutorial located here.