Music

This article about adding any track to any mod.

I have gathered tracks wich I don't own. You can't publish them in your mod. https://www.dropbox.com/s/wmsiga3vwr7p8v2/Music%20for%20mnb.zip?dl=0

There are epic, medieval and folk tracks. The best what I have found. It's subjective. You need to copy files to "Mount&Blade Warband\Music\" folder. There are txt files like music_native.txt wich you should rename to "music.txt" and copy to mod folder. Example, "Module\Native\music.txt". The hardcoded limit for adding tracks is 256. If music is switching too many times in small amount of time then memory will be consumed a lot. Integrated sound card creates a decompressed track in memory.

Tutorial
What you need:
 * You need a windows 7 calculator. Switch in programming mode.
 * Tracks can be in mp3, ogg or wav format.
 * header_music.py expanded with explanation and binary codes


 * 1) header_music.py
 * 2) This file contains declarations for music tracks
 * 3) DO NOT EDIT THIS FILE!
 * 1) DO NOT EDIT THIS FILE!

mtf_culture_1                = 0x00000001 ## 0000 0000 0000 0000 0000 0000 0000 0001  Kingdom of Swadia mtf_culture_2                = 0x00000002 ## 0000 0000 0000 0000 0000 0000 0000 0010  Kingdom of Vaegirs mtf_culture_3                = 0x00000004 ## 0000 0000 0000 0000 0000 0000 0000 0100  Khergit Khanate mtf_culture_4                = 0x00000008 ## 0000 0000 0000 0000 0000 0000 0000 1000  Kingdom of Nords mtf_culture_5                = 0x00000010 ## 0000 0000 0000 0000 0000 0000 0001 0000  Kingdom of Rhodoks mtf_culture_6                = 0x00000020 ## 0000 0000 0000 0000 0000 0000 0010 0000  Sarranid Sultanate mtf_culture_all              = 0x0000003F ## 0000 0000 0000 0000 0000 0000 0011 1111  ALL

mtf_looping                  = 0x00000040 ## 0000 0000 0000 0000 0000 0000 0100 0000 mtf_start_immediately        = 0x00000080 ## 0000 0000 0000 0000 0000 0000 1000 0000 mtf_persist_until_finished   = 0x00000100 ## 0000 0000 0000 0000 0000 0001 0000 0000

mtf_sit_tavern               = 0x00000200 ## 0000 0000 0000 0000 0000 0010 0000 0000 mtf_sit_fight                = 0x00000400 ## 0000 0000 0000 0000 0000 0100 0000 0000 mtf_sit_multiplayer_fight    = 0x00000800 ## 0000 0000 0000 0000 0000 1000 0000 0000 mtf_sit_ambushed             = 0x00001000 ## 0000 0000 0000 0000 0001 0000 0000 0000  enemies are 2 times more mtf_sit_town                 = 0x00002000 ## 0000 0000 0000 0000 0010 0000 0000 0000 mtf_sit_town_infiltrate      = 0x00004000 ## 0000 0000 0000 0000 0100 0000 0000 0000 mtf_sit_killed               = 0x00008000 ## 0000 0000 0000 0000 1000 0000 0000 0000 mtf_sit_travel               = 0x00010000 ## 0000 0000 0000 0001 0000 0000 0000 0000 mtf_sit_arena                = 0x00020000 ## 0000 0000 0000 0010 0000 0000 0000 0000 mtf_sit_siege                = 0x00040000 ## 0000 0000 0000 0100 0000 0000 0000 0000 mtf_sit_night                = 0x00080000 ## 0000 0000 0000 1000 0000 0000 0000 0000 mtf_sit_day                  = 0x00100000 ## 0000 0000 0001 0000 0000 0000 0000 0000 mtf_sit_encounter_hostile    = 0x00200000 ## 0000 0000 0010 0000 0000 0000 0000 0000 mtf_sit_main_title          = 0x00400000  ## 0000 0000 0100 0000 0000 0000 0000 0000 mtf_sit_victorious           = 0x00800000 ## 0000 0000 1000 0000 0000 0000 0000 0000 mtf_sit_feast                = 0x01000000 ## 0000 0001 0000 0000 0000 0000 0000 0000 mtf_module_track             = 0x10000000 ## 0001 0000 0000 0000 0000 0000 0000 0000

Adding new tracks
When you open file music.txt you will see fight_1.ogg 7168 7168 fight_2.ogg 7168 7168 fight_3.ogg 7168 7168

Copy that number and paste it in calculator. You will see bits.



By this bits we determine that this track is played in fights, multiplayer and fights when enemies 2 times more (ambushed).

If tracks are placed in the module folder you will see mtf_module_track bit.



You don't need to add mtf_module_track bit. Without it game engine first search in module folder for that track and if it doesn't found than it will look in Warband folder.

So to add new track just paste in the end of the music.txt file:

btl_new_track.mp3 7168 7168

When you have finished look in the begining of the file for counter. Native is 74. Look how many strings you have in the file in advanced txt editor. Change counter 74 to (Number_of_the_strings - 1).

First and second number
The first number is determine in witch situations track can start to play. The second determine in witch situation this track can continue to play. If situation is changed then this bits will be checked.

Changing header_music.py
You can't add new cultures but you can add new 3 situations in the free bits.

mtf_situation1     = 0x02000000  ## 0000 0010 0000 0000 0000 0000 0000 0000 mtf_situation2     = 0x04000000  ## 0000 0100 0000 0000 0000 0000 0000 0000 mtf_situation3     = 0x08000000  ## 0000 1000 0000 0000 0000 0000 0000 0000

Also you can change existing situations freely. This changes you need to adapt in module system.