Music modding

From Hearts of Iron 4 Wiki
Jump to navigation Jump to search

Adding your music file[edit]

  • Your music file should be in *.ogg format and put into the music folder of the game. You can find a lot of online converters on the internet.

Open the music.asset (/Hearts of Iron IV/Hearts of Iron IV/music/music.asset). In this file you'll add your music into the game. In this example we will name our file new song.ogg. The ID of the music file (A New Song) can't be longer than 63 characters (the german mutated vowels like ä, ü and ö count as 2 characters) or the file will fail to load at the start of the game.

music = {
  name = "A New Song"
  file = "new song.ogg"
  volume = 0.65

Don't forget to save the file.


Your music is technically added to the game, but now you have to define the conditions needed for your song to be played. Open the songs.txt (/Hearts of Iron IV/Hearts of Iron IV/music/song.txt).

  • The conditions use the same format as events, focuses, etc.

For our example, we want that our music be played only if we play a democratic peaceful USA (at the same time) :

music = {
  song = "A New Song"
  chance = {
    modifier = {
      factor = 2
      has_war = no
      TAG = USA
      has_government = democratic

Now your music is fully and properly added to the game and will be played if you play a peaceful, democratic USA. You can use almost all conditions. Don't forget to save once again.

Radio stations[edit]

In order to make radio stations, you need to do the following:

  • Activate the radio station in the file common/playlists/settings.txt. Stations are separated by spaces.
  • In gfx\interface or gfx\interface\topbar\musicplayer, you have to create an album cover ( You also need a faceplate, like
  • In interface\ you need two my-station_music.gfx and my-station_music.gui files to create the containers and tell where the gfx files are. Be sure to tell the right paths to the gfx files, otherwise they won't display.
  • In localisation\ you need to create a localisation file. The name of your station has to be entered as my-station_TITLE:0 and the rest is to specify the names of the tracks.
  • In music\ you have folders for each radio station, such as my-station. Each contain two files my-station_music.asset and my-station_soundtrack.txt using the variables for each track that are used in localisation\. The tracks have to be in .ogg.

A good model to work with are the two Sabaton music DLC.


It's possible to set songs inside "radio stations". Modding it in is relatively simple, involving adding some new lines in the songs.txt file, creating a new localisation file (to give a name to the station), and even add a new album cover (inside /interface and /interface/musicplayer).[1]