Author Topic: How-To: Customize sounds.txt  (Read 435 times)

0 Members and 1 Guest are viewing this topic.

Offline korppis

  • Earl
  • ******
  • Renown: 404
  • Infamy: 51
  • cRPG Player Sir White Knight A Gentleman and a Scholar
    • View Profile
  • Faction: Ninja
How-To: Customize sounds.txt
« on: August 05, 2014, 01:14:14 pm »
+3
There's quite a few different sound mods around, plus crpg has it's own custom voices now and people tend to have different taste of what is good and what's not. The problem is that all those mods have separate sounds.txt file and sometimes people don't like all the voices that come in bundle. So, here's a small guide about how to deal with the file so that you can customize your own sounds. Combine the best of all mods and take away annoying sounds if you will.

Tools
I'd recommend using some nice little text/code editor that has file differ tool and which shows line numbers. You're going to need it if the devs add new sounds. I personally prefer Sublime Text because it also has so many other nice features (such as multiline edit) to make working fast and easy.

Backups
Always keep the module's original sounds.txt files in backup, so that when it gets updated you can compare it to the older version and see what was changed (ie new sounds added or new samples added to old sounds).

Sounds.txt file
Because picture speaks more than 1000 words:
(click to show/hide)

The file has two parts:

1) First part lists sound sample files to be used. The section starts with a number that tells how many samples there is to read (each sample is on it's own line so it's also a line number, thus easy to calculate in an editor with line numbers). The index/offset starts from zero, and the first sample is on line 3, so for example if you need to find the sample number 534, it will be on line 534+3 = 537. If you need to navigate the other way around, and figure what offset the sample on line 35 has, that would be same as 35-3 = 32.

2) Second part also starts with a number, telling how many sounds (=lines) there is. Each line starts with sound name, followed by a  serie of numbers/values. I'm not quite sure what the first value means, could be a value telling the priority and/or volume... either way, I've never needed to change that. The second value tells the number of samples for that sound. After this, the rest of the values are to be read in pairs, where the second number is always a zero (again, not sure if that latter zero value has any meaning, or is it just used as a separator). The first number in that pair is the sound sample's index/offset in first part's sample table. So if you see a sound with sample definition 13 0, you can see the corresponding sample file on line 16 (13+3). Note: It's very important that the sample value (2nd value) corresponds to the sample pair number (offset followed by a zero), otherwise the file won't load.

Adding new sound samples
- If you add new sound samples (first part), ALWAYS add them to the end of the list. If you push them in between old values, every sample from that offset and up will get shifted, which means you'd have to manually rework the whole 2nd part and increase all those messed up offset values.

- Remember to increase number of samples on line 2.

Disabling sound samples
If you locate a voice file that you really hate and want to get rid of it, you can just rename that entry (in 1st part), ie "annoying_sound.ogg 2705" -> "DISABLED_annoying_sound.ogg 2705".

Troubleshooting
Quote
Wrong voice commands
If for example "Attack"-command plays "Flank left" sound.
This is because the sample value in second part matches wrong offset on sample list. Most likely a new sound has been added somewhere in between the list. File diff with old working version should help pin point the changed line.

Quote
Error: "More than 32 samples per sound"
You get this error on load if you add new sample to a sound, but forget to increase the number of samples (2nd value after the sound name).

Quote
Script errors in game
Could be because devs have added new sound to the game, but those are missing from your sounds.txt file (2nd part). Some sounds trigger so rarely that you might not see the script errors often. File diff the original files and add the new sounds to your own sounds.txt.