5. From OGG files to Background Music: SOUNDS.DAT
Movement, Weapons and Explosions sounds were explained in great detail in my
Diary #1.
Let us build from there. First, the
SOUNDS.DAT file. They vary a bit from game to game, here is what the East Front variant looks like:
5 4 5 5 5 3 1 3 2 2 5 4 5 1 3 2 2 2 1 2 2 1 1 1 1 3 1 5 1 2 1 0 0 0 0
5 4 2 2 1 2 1 5 1 1 1 1 5 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 1 1
3 6 8 17
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
7 6 6 6
6 3 4 4
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
7 5 4 5
From Diary #1, we learnt about
movement and weapon sounds. They had to do with
the first two rows of parameters.
Third line? It provides the max amount of sound file variants for
Assault, load/unload, and mine attack sounds. It is not relevant for this particular exercize.
Background music is the fourth row, highlighted above. Let us study it in detail.
3, 6, 8, and 17. What do they refer to?
I happen to know that all background OGG files have *backg* in their names. Let us do a search for East Front folder:
That is:
- 3 abackg*.OGG files, where * is a numeral from 0 upwards.
- 8 backg*.OGG files,
- 10 nbackg*.OGG files,
- 2 pbackg*.OGG files, and finally,
- 6 xbackg*.OGG files.
And here's what do they stand for:
- backg*.ogg are combat sound files
- nbackg*.ogg are neutral music files
- abackg*.ogg are allied music files
- xbackg*.ogg are axis music files
- pbackg*.ogg are national anthems
Relevant to us are all but the national anthems, as they are not used for Background Music.
So, we have pretty much cracked the code for the fourth row of SOUNDS.DAT file. I can confirm the current line #4 refers to, in this order:
- 3 abackg*.ogg files, all present,
- 6 xbackg*.ogg files, all present,
- 8 backg*.ogg, all present, and finally:
- 17(!) nbackg*.ogg files, of which 10 are available to be played. Again, an anomaly in the legacy data I only now spotted. Something to be fixed for 2.1 then.
One more question before we proceed, though. How are they used?
First, the code checks if Background Music is toggled ON in the Options menu.
- If yes: a first die roll: 50% chance for still playing one of the combat sound files, or 50% chance for playing a background music sound file.
- If combat sound wins: a random die roll from 0 to 7 to play a respective backg[0-7].OGG file.
- If background music wins, another 50% die roll is cast: for a neutral music file or a side specific music file.
- If neutral music wins: a random die roll from 0-16 to play a nbackg[0-15].OGG file, so many times no sound played at all I think as currently there's only 10 of them.
- If side specific music wins: a random die roll either from 0-2 for Allied abackg[0-2].OGG files or 0-5 to play one of the xbackg[0-5].OGG files.
With the above numbers-per-file-type I referred to said current SOUNDS.DAT parameters of current line #4: 3 6 8 17
Edit, ten years(!) later: Background Music option now (as of VN1.31/ME2.31) only plays music, with 50% chance of neutral or side-specific kept.
Special case: xbackg1.OGG is also played for the Main Menu background music. This is the tune you will hear when selecting which scenario to play from the menu. So going forward, let us pay special attention to this one.