Creating your own Soundtrack!

Leugi

Supreme Libertador
Joined
Jan 25, 2013
Messages
1,675
Location
Bolivia
So, I've been toying around searching for a ways to create my own soundtrack, and I finally managed it... Also, now that the fall patch has enabled Music Modding, this will come in handy for those making full conversion mods, or even a personal soundtrack...

This tutorial assumes you got some basic modding knowledge, and now how to use ModBuddy and edit an xml. If you don't know this, I'd suggest Kael's guide. Please, also note that while this tutorial may look really long, it is only because it is very descriptive, the process itself is quite fast really...

We're understanding "Soundtracks" as the generic regional music that plays once you're playing the game, that doesn't depend on the leader. This one can be defined for all civs through a <SoundtrackTag>

What you'll need

Step 1: Order up your files.

So... You'll need to have all your music in a nice and ordered way... For achieving such a thing, I'd suggest using Firaxis' pattern (check the following folder: (Installation Folder)\Assets\Sounds\Streamed\Music\Europe\...)

There are folders for each circumstance: Peace, Either and War (Either plays on either situations.) The ammount of music is the following:
  • Europe: Either 13, Peace 26, War 37.
  • America: Either 23, Peace 25, War 24
  • Asia: Either 18, Peace 26, War 26
  • Middle East - Africa: Either 13, Peace 16, War 25.

Just so we won't get lost in more than 50 files, I'd suggest using the same folder names: Either, Peace and War...

Step 2: Create your Modfile

Now, let's open ModBuddy, and add up our music files and folders. Remember to set the Music files VFS=True, or it won't work... The Solution Explorer should look like this:



A very important step, after the fall patch its important to set your mod to "ReloadAudioSystem", in the Actions tab at your mod properties.

Step 3: Define your files.

We need to define the SoundIDs of each of our new music files... The way music is defined is as follows:

Code:
<GameData>
	<Audio_Sounds>
<Row>
	<SoundID>SND_CUSTOM_PEACE_01</SoundID>
	<Filename>[B]YourFileName[/B]</Filename>
	<LoadType>DynamicResident</LoadType>
</Row>
<Row>
	<SoundID>SND_CUSTOM_PEACE_02</SoundID>
	<Filename>[B]YourOtherFileName[/B]</Filename>
	<LoadType>DynamicResident</LoadType>
</Row>

....

<Row>
	<SoundID>SND_CUSTOM_WAR_26</SoundID>
	<Filename>[B]YourFinalFileName[/B]</Filename>
	<LoadType>DynamicResident</LoadType>
</Row>

</Audio_Sounds>
</GameData>

Remember that the Filename tag must not have an Extension... Also, it is recommendable to follow a nice numeration on the SoundID so you'll not get lost afterwards... Instead of PEACE use EITHER or WAR depending of the case...

Also, instead of CUSTOM you can name it whatever you wish, like... I don't know... AFRICAN, AUSTRALIAN, FANTASY or whatever... The name is very important, since this is how we'll assign it to the civ we want.

It is also a good idea to put a <!--Comment--> before your defines, so you won't get lost the next time you edit them or if you want to remove them.

Step 4: Because the worst part isn't over... now the Audio 2D Scripts

This step is fairly simmilar to the last one. What we did in the last step was defining what file would a SoundId play. Now we will create a name for the Script that will play the SoundId. They are defined as follows:

Code:
<GameData>
	<Audio_2DSounds>

		<Row>
	<ScriptID>SONG_CUSTOM_PEACE_1</ScriptID>
	<SoundID>SND_CUSTOM_PEACE_01</SoundID>
	<SoundType>GAME_MUSIC</SoundType>
	<MinVolume>40</MinVolume>
	<MaxVolume>40</MaxVolume>
	<IsMusic>True</IsMusic>
</Row>

...

		<Row>
[I]	<ScriptID>SONG_CUSTOM_PEACE_30</ScriptID>
	<SoundID>SND_CUSTOM_EITHER_04</SoundID>[/I]
	<SoundType>GAME_MUSIC</SoundType>
	<MinVolume>40</MinVolume>
	<MaxVolume>40</MaxVolume>
	<IsMusic>True</IsMusic>
</Row>

...

		<Row>
	<ScriptID>SONG_CUSTOM_WAR_3</ScriptID>
	<SoundID>SND_CUSTOM_WAR_03</SoundID>
	<SoundType>GAME_MUSIC</SoundType>
	<MinVolume>40</MinVolume>
	<MaxVolume>40</MaxVolume>
	<IsMusic>True</IsMusic>
[I]<Priority>1</Priority>[/I]
</Row>

...

	</Audio_2DSounds>
</GameData>

Some suggestions and important recommendations here:
  • The <Priority>1</Priority> tag means that the music will have priority over others, so if you want a music to play more often than the others, use that one.
  • You'll likely have to lower the volume for many of your new music tracks. The default volume is 40.
  • "SONG_CUSTOM_PEACE_1", the CUSTOM part is how the Soundtrack will be named and called, so you can change it, but its very important that you use the same pattern on every Script2Dsound you add
  • There's actually no "EITHER" sound scripts. All the Either soundtracks are used both as "PEACE", and "WAR", so define them as such.

Step 5: Assign your new Soundtrack to a Civ

Now we need to tell the game our civ will use our new Soundtrack... For this, you'll need to change the Civilization table through an xml... like this:

Code:
<Civilizations>
		<Row>
			<Type>CIVILIZATION_INCA</Type>
			<Description>TXT_KEY_CIV_INCA_DESC</Description>
			<ShortDescription>TXT_KEY_CIV_INCA_SHORT_DESC</ShortDescription>
			<Adjective>TXT_KEY_CIV_INCA_ADJECTIVE</Adjective>
			<CivilopediaTag>TXT_KEY_CIV5_INCA</CivilopediaTag>
			<DefaultPlayerColor>PLAYERCOLOR_INCA</DefaultPlayerColor>
			<ArtDefineTag>ART_DEF_CIVILIZATION_INCA</ArtDefineTag>
			<ArtStyleType>ARTSTYLE_SOUTH_AMERICA</ArtStyleType>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>PACHACUTI_CIV_COLOR_ATLAS</IconAtlas>
			<AlphaIconAtlas>PACHACUTI_CIV_ALPHA_ATLAS</AlphaIconAtlas>
			<MapImage>MapInca360x410.dds</MapImage>
			<ArtStyleSuffix>_AMER</ArtStyleSuffix>
			<ArtStylePrefix>AMERICAN </ArtStylePrefix>
			<DawnOfManQuote>TXT_KEY_CIV5_DAWN_INCA_TEXT</DawnOfManQuote>
			<DawnOfManImage>DOM_Pachacuti.dds</DawnOfManImage>
			<DawnOfManAudio>AS2D_DOM_SPEECH_INCA</DawnOfManAudio>
			[B]<SoundtrackTag>CuStoM</SoundtrackTag>[/B]
		</Row>
...

The thing with the SoundtrackTag is that it uses the Script IDs automatically, deciding to use whatever is after SONG_ and before _WAR (or _PEACE): SONG_CUSTOM_WAR_34... Capitals don't matter for the SoundtrackTag.

And there... You may now enjoy your new Soundtrack! (don't forget to activate the Modfile with your Music files)

Important Questions
SQL?
Yeah, I'm pretty sure this works through SQL too, if you wish to try.

Can we use this method to add new music to an existing soundtrack or to remix our own soundtrack with core music?
Yes, simply use <Update> tags instead of <Row> (to change an AudioDefine) or just add them (to add an AudioDefine to a soundtrack)

If you want to see a new soundtrack in action, please check this mod.
 

Attachments

  • XMLAudioSamples.zip
    1.7 KB · Views: 645
Thanks a lot for this tutorial!
What I'd really like to find is a way to create era-dependent soundtracks like in Civ 4. There seem to be defines for it in the era info .xml files, but they might just be vestigial.
 
Ok. This tutorial has been updated, and is now up to date with the Fall Patch!

Now we can do this modularly, so yeah, rejoice!
 
Ok. This tutorial has been updated, and is now up to date with the Fall Patch!

Now we can do this modularly, so yeah, rejoice!

Hm, I tried doing this as your tutorial said and it isn't replacing any music for existing civs (I tested it using SQL to set America's SoundtrackTag to AmericaNew).
 
Thank you Leugi! This is a great tutorial! I was wondering if we could just simply use MP3s, instead of trying to convert to .ogg first! Love the fact we can use mp3!
 
Yeah, Mp3 works, and since the Fall Patch update sql should work too.

So, hey FramedArchitect, maybe you could post some example sql files for music too! For some using sql is easier and faster :goodjob:
 
..maybe you could post some example sql files for music too!

The Faerun Soundtrack uses sql.

One thing to note is that the ScriptID column in the Audio_2DSounds table cannot be incremented as KEY_01, KEY_02, etc. The zero is somehow not considered an integer key. You should enumerate the ScriptID (as in original post) with KEY_1, KEY_2, ....

The SoundID column in the Audio_Sounds table, however, can be keyed however you want: 'SND_ELTONJOHNSONGHERE_1', 'ELTONJOHNSONGHERE_01', '1972_ELTONJOHNSONGHERE', etc, as long as it is unique.

The Audio Tab of the FireTuner can be very useful when editing your soundtrack.
 
Does this work with updating menu music as well?
 
I am trying to add music to my mod, but I keep getting this error when I compile:

------ Build started: Project: Night Vale, Configuration: Default x86 ------
PRE: True
PRE: False
Creating target folder structure...
Copying files...
Cleaning Package location...
Packaging mod...
C:\Program Files (x86)\MSBuild\Firaxis\ModBuddy\Civ5Mod.targets(129,9): error MSB4018: The "PackageMod" task failed unexpectedly.
SevenZip.SevenZipException: The execution has failed due to the bug in the SevenZipSharp.
Please report about it to http://sevenzipsharp.codeplex.com/WorkItem/List.aspx, post the release number and attach the archive.
at SevenZip.SevenZipBase.ThrowException(SevenZipBase handler, Exception[] e)
at SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, SevenZipBase handler)
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames)
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames)
at SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames)
at Firaxis.ModBuddy.Civ5ModBuildTasks.PackageMod.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
Done building project "Night Vale.civ5proj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

Any thoughts?
 
Ambug666: Have you tried closing modbuddy and building again? That happens to me sometimes and that's how its fixed.

Another option is checking that there's no file from the mod being opened by another program.
 
Ambug666: Have you tried closing modbuddy and building again? That happens to me sometimes and that's how its fixed.

Another option is checking that there's no file from the mod being opened by another program.

Closing and reopening worked. Thanks!
 
Oooh, that's a nice tool, I'll test it and update the tutorial.
 
Thanks for the tutorial, Leugi! My ancient British civs now have appropriate music ;).

It's worth mentioning here that I didn't get it to work first time round. I thought I'd done everything Leugi had said - and I had except for one thing. I had labelled the Audio_2DSounds as "SONG_CUSTOM_PEACE_01" etc - with the "01" being acceptable in the Audio_Sounds part. However, this doesn't work - but "SONG_CUSTOM_PEACE_1" does.
 
Leugi, can you or somebody who knows how to make a soundtrack work with .mp3 files take a look at mine and see what is keeping it from working? All files except the XML and SQL have been loaded into VFS and the three code files have been set to UpdateDatabase, so I'm really at a loss by now.:sad:

Also, whoever looks at this, please don't tell too many people about it...I want it to be a surprise.

EDIT: Never mind, it appears that the soundtrack (Star Wars) would be a copyright violation. So I will muddle through it on my own and use it privately.
 
Does SND_CUSTOM_PEACE_1 work in <Audio_Sounds> or does it have to be SND_CUSTOM_PEACE_01?

Yes, it must be SND_CUSTOM_PEACE_1 for the first 9 entries.

If you instead put 01-09, for me at least, it would play no music until I met a Civ, and then it would keep playing that music until another Civ talked to me or something.

Even the Music Skip Button mod did nothing when clicked.

So 1-9.
 
Top Bottom