[19 July 2012] v1.2 - fixed: v1.1 (might?) fail to run correctly on Vista/Windows7
This extracts sound dat/idx files in a simple-to-use fashion. It includes and uses the XIDX tool for the extracting operation. All I have done is added a BAT file to simplify its operation and have the sounds extracted to folders directly under the "sounds" folder.
The intention is that submods that add/change sounds no longer need to package up and distribute the dat/idx files. Instead, they only need to distribute the actual wav/mp3 files and have the users run this BAT file. This avoids sound incompatibility problems between submods (where two submods both include dat/idx files) and reduces the size of the submod download.
The rest of this post is aimed at submod authors who wish to use this and anybody who is merging more than one submod where one (or more) is using this method.
Background
The game reads sound files from the dat/idx files under the sounds folder. If any of these dat/idx files do not exist then the game - during startup - rebuilds them from the contents of the Music, SFX and Voice subfolders and the contents of the sound text files. (NOTE: if the mod is for Kingdoms and it does not already have the missing sound files then you will need them.)
Therefore, to add a new sound three steps are needed:
Extract the dat/idx files into the Music, SFX and Voice subfolders of the sound folder
Add your sound to the appropriate place in these subfolders (and into the appropriate sound text file)
Delete the dat/idx files, forcing the game to rebuild them from the subfolders
Normally, as a submod author who is trying to add a sound, you would do this dat/idx rebuilding yourself and include the dat/idx files in your submod, overwriting the ones already in the mod when the submod is installed. The problem with this is:
If another submod is doing the same thing (including dat/idx files) then they are incompatible: one submod will overwrite the other's dat/idx files. It would be up to the user who is trying to use both of them to unpack, merge and rebuild the sound files; no small task, especially for someone who doesn't already know how to do this kind of thing.
Your submod's size could now be hundreds of megabytes because it contains large dat file(s), even though your only addition might be one sound file of a few kilobytes.
SoundExtractor
By using SoundExtractor instead you would:
Include just the new sound file in your submod's distribution (instead of the dat/idx files), in the appropriate sounds subfolder location.
Instruct the user what to do:
Download SoundExtractor and run SoundExtractor.bat. [The sound subfolders now exist on the user's PC.]
Install your submod. [Your new sound file now exists in the user's sounds subfolder tree.]
The dat/idx files are rebuilt when the user next starts the game.
To make the user's life even easier you could bundle SoundExtractor in with your submod's distribution. That way the user doesn't need to download it separately and unzip it. BUT: only if you are adding sounds. If you are replacing a sound that already exists then it won't work because when the user installs your submod it will put that sound file under the relevant sounds subfolder, then when the user runs the BAT file the extracting process will overwrite your file with the one from the dat file. i.e. For replacing sounds the extracting needs to be done before your sound files are moved into the sounds subfolders.
Merging Multiple Submods
To combine sounds from more than one submod the goal is this: get all of the sounds into the sounds subfolders and only then start the game to combine them all into the rebuilt dat/idx files.
If you install one submod and start the game then the dat/idx files are now rebuilt; any files added to the sounds subfolders after that (from another submod) will be ignored because the game can see - and will use - just those dat/idx files. However, easily fixed: just delete the dat/idx files. They will now be rebuilt including the other sound files you added.
If a submod includes sound dat/idx files then make sure that these files are in the sounds folder before running SoundExtractor.bat.
If two submods include sound dat/idx files then do the submods one at a time:
Put the files from submod 1 in the sounds folder and run SoundExtractor.bat
Put the files from submod 2 in the sounds folder and run SoundExtractor.bat
Credits
The Europa Barbarorum Team for the XIDX tool which is based on the work of Vercingetorix. Thank you Tellos Athenaios for the permission.
Terms Of Use
XIDX and this SoundExtractor BAT file are licensed under GPL. Meaning, essentially: it is free and there is no warranty whatsoever. Use at your own risk. See licence.txt for a copy of the full licence.
Compatibility
This should also work for RTW. XIDX certainly does but I have not tested this SoundExtractor on RTW.
EDIT: update: I just realised that the BAT file mentions Third_Age_3 as the correct location when showing a wrong location message. Fixed in the new v1.1.
Last edited by Withwnar; May 31, 2012 at 11:41 PM.
Now you may install the files for the submod that this SoundExtractor is being used for. Do not start the game until the submod is installed.[/contentbox][/fieldset]
Great tutorial, but could you clarify me this part? ^ The command window said it had finished. I went to data/sounds and there where 5 files: voice, SFX, music, effect_evt and backup. Inside of them there are the mp3 files. Is there anything I have to do before I start the game? What files do I have to install?
Thank you very much, and sorry for my lack of hability
There are three cases where you would need to use this tool:
1) A submod is adding sounds and told you to use this. These tool instructions are saying use this tool to extract, then install the submod's files*, then start the game.
2) You're adding/changing sounds of your own, not from a submod. In that case drop your sounds files into the relevant folders that this extractor has created, before starting the game.
3) You just wanted to extract the sounds so you could get to the MP3/WAV files to hear them or whatever. There's nothing else to do in this case.
* The submod will add/change sound files in the extracted folders.
I assume this tries to read the registry to get M2 installation folder...is there any workaround to this?
I dont want to install M2 again just to recreate the registry info, (i dont have m2 registry info because i installed it in an external drive with another machine than the one im currently using)
Oh NVM just had my folder structure not properly set
It works all good
Last edited by Melooo182; June 23, 2014 at 01:20 PM.
Hello I was wondering if you know how to solve this problem that I'm having with your sound extractor. Now first of all let me say this, your program works with mods but every time I use it to extract sounds for vanilla M2TW it extracts the sounds but not voices 1, 2, or 3 for some reason it doesn't extract or even show them other than just a folder called "voice" in my sounds folder yet I do have my UAC disabled, I have my SEGA folder with full permission to mod and what not, my antivirus disabled while extracting, run as administrator, game is installed under C:\Games\SEGA..., even unmarking them from READ ME in properties yet still no extraction I even used that IDX extractor from Vercingetorix yet every time the extractor gets to Voice 3 it crashes and skips the file. I'm right now thinking that I might need to redownload the game from Amazon maybe that could be the problem.
If you must know what business I have with extracting vanilla it's due to the fact that earlier I've fixed an issue involving missing sound effect for oil in my private Retrofit mod but unfortunately I have missing voices for certain faction on the campaign map with almost everybody having no voices while selected.
Any help would be appreciated. Thank you for your time.
I don't know what the bold bit means but anyway...
As this tool just uses XIDX I would try using that directly and if it doesn't work then ask for help in its thread. There's a link to it in the OP of this thread.
I had no problem using SoundExtractor on the vanilla files (Kingdoms v1.5) but that was only tested on a 32bit XP machine.
Last edited by Withwnar; June 20, 2016 at 10:10 PM.