Hearts of Iron III Guide

Adding Music to HoI III for Hearts of Iron III

Adding Music to HoI III

Overview

How to add MP3s to the Hearts of Iron play list.

Intro

I’ve been having a problem with strategy games for years now: there’s just not enough music! Game companies rarely put even an hour’s worth of music in but even if they pony up two hours, that’s still a lot of repeating music over a five hour gaming session – especially if you’re playing every day.

Now the obvious solution to this is to simply turn off the game’s music and play your own. That works fine but your music player isn’t going to know when you’re at war or at peace. Still, it’s easy and is good enough for many people.

But what if you could use music from other games? If you’ve got a lot of games installed from Steam then you’ve got a ton. Just do a search on *.mp3 in your Steam folder and you’ll see what I mean. What if Hearts of Iron played it’s own music plus the music in Civilization 5 plus the music in Galactic Civilizations 3 and maybe toss in a guest appearance from a couple of songs from The Witcher? And what if you could make it smart enough to play at more appropriate times, like the music that’s already in the game? Epic bliss!

How To

First you need to have run the game at least once. That should get a directory created to contain all the music for your game, some log files, a place for all your save games, and more. Unless you’ve been telling Windows to put your documents in special locations, the music directory should be here: “C:Users{USER}DocumentsParadox InteractiveHearts of Iron III” (though you will need to change “{USER}” to your own Windows user name). You’re going to be looking at the music subfolder and (later) the logs subfolder.

First look in the music directory. You should see several MP3s in there. Check to see if there is a songs.txt file there.

If there is no songs.txt there then you need to copy it from the game’s installation in the music directory. That will change depending on where you installed Steam and where you installed the game itself. Assuming you took all the defaults then I think it will show up in “C:Program Files (x86)SteamsteamappscommonHearts of Iron 3music”. Find the songs.txt file and copy it over to the “C:Users{USER}DocumentsParadox InteractiveHearts of Iron IIImusic” folder.

Next, copy an mp3 file of your own into the music folder under your user name. If the file name has any characters that aren’t letters or numbers (particularly spaces) in the name then you will need to rename the file to something more simple. The game is pretty choosey about names and, for whatever reason, can’t handle having a space character in the name.

Now double click on the songs.txt file and edit it. You’ll see all the game’s basic music files listed and the rules that govern when they play. Skip down to the very end of the file and add a new line to the file that looks like this:

song = { name = “BraveNewWorld.mp3” chance = { modifier = { factor = 2 } } }

Replace BraveNewWorld.mp3 with the name of your file. Make sure the name matches exactly. I don’t know if case matters but these things are tricky enough that it’s easiest to simply make it the same. You can experiment later if you want.

Now simply start the game up and play. Eventually, you’re song should come up at which time one of two things will happen. If you’re lucky, the song will play. If not, the music will stop and no more music will play for your entire play session.

The Music Is Gone From My Hearts!

Unfortunately, a lot of MP3s don’t work. I don’t know why. It doesn’t seem to be the recorded bit rate. Maybe it’s the kind of compression used? <shrug> I have found that if one MP3 from a game fails then it’s likely that all will fail. Master of Orion’s soundtrack doesn’t work for me, for instance.

When an mp3 doesn’t work and Hearts of Iron tries to play it, the music just stops dead and doesn’t come back until you quit and restart. If you’ve only added one song then you know where the problem is. Throw out the file and get another. If you added a bunch, though, you may not know which one broke. The music doesn’t play in order so it might not be the first one.

Lucky for you, HoI3 logs what music it tries to play. Go look in the “C:Users{USER}DocumentsParadox InteractiveHearts of Iron IIIlogs” directory for a file called “game.log”. Open that file up in a text editor and look at the end of the file. You should see all the music that played and the last file listed will be the mp3 that had the problem. Get that file out of the music directory and songs.txt and fire up the game again.

Getting Fancy

But wait, there’s more!

Remember all those songs you skipped over in songs.txt. Well, take a look at them. It’s not terribly clear exactly what each one is doing but come on, if “unclear” put you off then you wouldn’t have lasted half an hour in Hearts of Iron! You can still get the gist of what’s going on. I believe setting factor to 0 turns off a song while setting it to 2 turns it on. (Setting factor to 1 doesn’t seem to do anything.)

Using those existing songs as a guide, you can change the settings on your own songs. Instead of using the simple song entry I gave above, copy one of the existing entries, change the song file to your own MP3 and (if you feel like experimenting) change a few of the numbers a little.

Additional

I’ll add additional stuff I figure out here…

  • OGG files don’t seem to work.
  • When I started a new game and simply left it there for several hours, the game repeated a small list of music files over and over despite there being several more on my list.
SteamSolo.com