This tutorial shows you how to customise the music played in Stronghold 2 and covers changing music volumes, altering playlists and adding your own music...
Submitted by TTemplar, LordBritian and Aubergine
Note: Where applicable, you can click images below to see bigger versions. Music Files and Settings Locations The music files and their settings are stored, by default, in the following folder: C:\Program Files\Firefly Studios\Stronghold 2\fx\music 
There are two files in particular that we're interested in: - Music volume levels.txt - this can be edited with Notepad and allows you to set volume levels for each music file
- sh2_PlayLists.csv - this can be edited with Microsoft Excel and defines all the music playlists for the game
Before going any further, make a copy of these files (select them, right-click and choose "Copy" then go to your desktop and right-click then choose "Paste"). Adding Your Own Music If so desired, you can add your own music to the game quite easily as long as it is in the correct format. The formats that can be used are: - wav - The standard windows sound file format
- mp3 - The standard format for most music files
This tutorial does not include any advice on how to create music files so you'll have to search the Internet to find out more if you don't already know how to do that. Once you have got your music files, the first step of getting them played in the game is to copy them in to the music folder. You then have to define the volume level for your music file and also put it in a playlist, both of which are described below... In the rest of this tutorial, we refer to "track1.mp3" as a custom music file that's been copied in to the music folder. Setting Music Volume To change the volume of any music file, double-click on the "Music volume levels.txt" file which will open it in Notepad showing something like this (note that our pic is scrolled near the end of the file): 
Each line represents a single music file and consists of: - The music file name with the extension removed, eg. the file "twomandolins.mp3" becomes "twomandolins"
- A comma "," to seperate the file name from the volume
- A number representing the volume
The default volume setting is 100 which basically means "use the default volume of the music file". You can however, increase or decrease the volume by altering the numbers: - Increase: Any number over 100 will increase the volume - the higher the number, the higher the volume. For example, 140 would be louder than 120.
- Default: 100 is the default volume taken from the music file itself
- Decrease: Any number lower than 100 will decrease the volume - the lower the number, the lower the volume. For example, 60 would be quieter than 80.
If you have added your own music file, in our case "track1.mp3" then you need to add a line to the volume settings file to define it's volume. As we've stated above, it's probably best to start with 100 (default volume) when adding your own music and then play the game to see how loud the music is in comparison to the other music. Once you have finished changing the volumes, save the file and exit Notepad. You will likely need to restart the game to make the volume settings take effect. Editing Playlists For a music file to be played in the game, it must be included in the playlist file. We strongly recommend using Microsoft Excel to edit the playlist file, unless you are very familiar with the CSV file format. With Microsoft Excel installed, simply double click on the "sh2_PlayLists.csv" file and you should get something that looks like this: 
Note: You might need to resize the columns to get everything displayed properly as shown above. As you can see from the picture above, the file is split in to several playlists shown in column A. Each playlist then defines it's music files and other settings in column B. Here's a quick summary of what the standard playlists refer to: - PL_NULL - a playlist that is silent
- PL_DEFAULT - the default music playlist
- PL_LOADING - played while the game loads
- PL_MAINMENU - played on the main menu
- PL_MAP_EDITOR - played in the map editor
- PL_TUTORIAL - played in the tutorial mission
- PL_BRIEFING - played on briefing screens
- PL_KINGMAKER - played either in kingmaker missions or possibly when choosing kingmaker settings?
- PL_SMALL_POP_EARLY - default music played when you have a small population and a low rank
- PL_SMALL_POP_LATE - default music played when you have a small population and a higher rank
- PL_MED_POP_EARLY - default music played when you have a medium sized population and a low rank
- PL_MED_POP_LATE - default music played when you have a medium-sized population and a higher rank
- PL_LARGE_POP_EARLY - default music played when you have a large population and a low rank
- PL_LARGE_POP_LATE - default music played when you have a large population and a higher rank
- PL_CHAPTER8 - played in Chapter 8 of the Path of War campaign or possibly no longer used?
- PL_SMALL_VICTORY - played when you are victorious but lost almost as many troops as the enemy (or have very few troops left)?
- PL_BIG_VICTORY - played when you decisively defeat the enemy
- PL_SMALL_DEFEAT - played when the enemy defeats you but looses almost as many troops as you (or has only a few troops left)?
- PL_BIG_DEFEAT - played when the enemy decisively defeats you
- PL_SKIRMISH1 - ?
- PL_SKIRMISH2 - ?
- PL_SKIRMISH3 - ?
- PL_SKIRMISH4 - ?
- PL_SKIRMISH5 - ?
- PL_BATTLE1 - played during a battle?
- PL_BATTLE2 - played during a battle?
- PL_BATTLE3 - played during a battle?
- PL_BATTLE4 - played during a battle?
- PL_BATTLE5 - played during a battle?
- PL_BATTLE6 - played during a battle?
- PL_BATTLE7 - played during a battle?
- PL_BATTLE8 - played during a battle?
- PL_FIGHTINGMIX_SMALL - ?
- PL_FIGHTINGMIX_LARGE - ?
- PL_CS_PEACE_M0_01 - As there is no Mission 0, we don't know what this relates to
- PL_CS_PEACE_M1_01 - played in PoP, Mission 1
- PL_CS_PEACE_M2_01 - played in PoP, Mission 2
- PL_CS_PEACE_M3_01 - played in PoP, Mission 3
- PL_CS_PEACE_M4_01 - played in PoP, Mission 4
- PL_CS_PEACE_M5_01 - played in PoP, Mission 5
- PL_CS_PEACE_M6_01 - played in PoP, Mission 6
- PL_CS_PEACE_M7_01 - played in PoP, Mission 7
- PL_CS_PEACE_M8_01 - played in PoP, Mission 8
- PL_CS_PEACE_M9_01 - played in PoP, Mission 9
- PL_CS_PEACE_M9_02 - played in PoP, Mission 9 - possibly no longer used?
- PL_CS_PEACE_M10_01 - played in PoP, Mission 10
- PL_CS_PEACE_M10_02 - played in PoP, Mission 10 - possibly no longer used?
- PL_CS_PEACE_M11_01 - played in PoP, Mission 11
- PL_CS_PEACE_M12_01 - played in PoP, Mission 12
- PL_CS_WAR_M1_01 - played in PoW, Chapter 1
- PL_CS_WAR_M1_02 - played in PoW, Chapter 1 - possibly no longer used?
- PL_CS_WAR_M2_01 - played in PoW, Chapter 2 Mission 1
- PL_CS_WAR_M2_02 - played in PoW, Chapter 2 Mission 2
- PL_CS_WAR_M2_03 - played in PoW, Chapter 2 Mission 3
- PL_CS_WAR_M3_01 - played in PoW, Chapter 3
- PL_CS_WAR_M4_01 - played in PoW, Chapter 4
- PL_CS_WAR_M5_01 - played in PoW, Chapter 5 Mission 1
- PL_CS_WAR_M5_02 - played in PoW, Chapter 5 Mission 2
- PL_CS_WAR_M6_01 - played in PoW, Chapter 6 Mission 1
- PL_CS_WAR_M6_02 - played in PoW, Chapter 6 Mission 2
- PL_CS_WAR_M6_03 - played in PoW, Chapter 6 - possibly no longer used?
- PL_CS_WAR_M6_04 - played in PoW, Chapter 6 - possibly no longer used?
- PL_CS_WAR_M10_01 - played in PoW, Chapter 10
- PL_CS_WAR_M10_02 - played in PoW, Chapter 10 - possibly no longer used?
- PL_CS_WAR_M11_01 - played in PoW, Chapter 11 - both missions?
- PL_CS_WAR_M12_01 - played in PoW, Chapter 12
- PL_CS_WAR_M12_02 - played in PoW, Chapter 12 - possibly no longer used?
- PL_CS_WAR_M12_03 - played in PoW, Chapter 12 - possibly no longer used?
- PL_CS_WAR_M15_01 - ?
- PL_CS_WAR_M15_02 - ?
- PL_CS_WAR_M15_03 - ?
- PL_CS_WAR_M15_04 - ?
- PL_CS_WAR_M16_01 - ?
- PL_CS_WAR_M16_02 - ?
- PL_CS_WAR_M17_01 - ?
- PL_CS_WAR_M17_02 - ?
- PL_CS_WAR_M20_01 - ?
- PL_CS_WAR_M20_02 - ?
- PL_CS_WAR_M21_01 - ?
- PL_CS_WAR_M21_02 - ?
- PL_CS_WAR_M22_01 - ?
- PL_CS_WAR_M22_02 - ?
- PL_CS_WAR_M24_01 - ?
- PL_FIGHTINGMIX_SMALL2 - ?
- PL_FIGHTINGMIX_SMALL3 - ?
- PL_FIGHTINGMIX_SMALL4 - ?
- PL_ECONOMY1 - ?
- PL_ECONOMY2 - ?
- PL_ECONOMY3 - ?
- PL_ECONOMY4 - ?
Note: As you can see, there are quite a few playlists that we're not sure about. If you have any details, please post comments at the end of this tutorial. In theory you can add your own playlists to the end of this file, but at present there seems to be no way to script which playlist to actually play in your maps. We assume that feature might be added at a later date. Now, let's take a look a the contents of a playlist... 
This map editor playlist has 10 items in it as follows: - Play "Virgin Territory.wav"
- Leave a 60 second silent gap before playing the next song
- Play "Happy_01.wav"
- Leave a 150 second silent gap before playing the next song
- Play "Virgin Territory.wav"
- Leave a 30 second silent gap before playing the next song
- Play "Happy_02.wav"
- Leave a 120 second silent gap before playing the next song
- Play "Mattsjig.mp3"
- End of the playlist so go back to the top and start again
So, as you can see, there's three types of things found in a playlist: - Music file - at leat one must be specified - simply specify the filename and it will be included. Note: Although the extension is needed, when we look at the files in the music folder many of those from the example actually had a ".mp3" extension and not a ".wav" extension - it's possible that the extension isn't needed?
- Silent gap - optional - specify the number of seconds you want to pause using *silence(x) where x is the number of seconds
- End of playlist marker - the playlist must always end with this - *end() marks the end of your playlist and tells the game to go back to the beginning of the playlist and start all over again
Let's say you want to add a custom music file, "track1.wav" to the end of the map editor playlist - in most cases you'd also want a gap before hand and in our example we'll add a 60 second gap: 
It's that simple! When you are done, save the playlist file and when you restart the game your music should now be included. Notes We just wanted to point out two critical things once more: - Always backup your files before changing anything
- If you are including your own music you need to ensure:
- It must be in the correct format (wav or mp3)
- It must be placed in the music folder as shown earlier
- It's volume must be specified in the volume settings
- It must be listed in a playlist
Well, that's all for now. Happy modding!
|