I'll be referring to the mod folder as MOD or DataMOD in this tutorial, but it'll be whatever you have named yours.
So, first off, there's two file formats you'll need to implement custom SFX:
Create a folder inside DataMOD/Sounds/worlds and name it whatever you want (most likely the three letter MOD name)SND - this is the actual configuration file that stores what samples are called, pitch, volume, etc.
ASFX - this is where the samples called by the SND are stored.
Inside that, you'll also need two folders - effects, and samples.
Basically, this is what the folder will look like:
First, you'll need your sound effects placed into the effects folder. These sounds, ideally, should be saved as 22kHz mono wav files.-base REQ file (the MOD id)
--REQ file for effects and streams called for CW (MODcw)
--ASFX file for effects and streams called for CW (MODcw)
--Same as above, but for GCW
--SND files - doesn't have to be for both, and you can have as many of these as you like. The best practice here is to have an SND file for shared SFX (in this instance it would be the LEGO brick explosions upon death) and a separate one for each era. These can be called whatever you want but for simplicity's sake I'll go with MODcw, MODgcw, and shared.
Next, you'll need to set up the REQ files. Open MOD.req. This is what needs to be inside:
Code: Select all
ucft
{
REQN
{
"str"
"align=2048"
}
REQN
{
"lvl"
"MODcw"
"MODgcw"
}
}
Code: Select all
ucft
{
REQN
{
"bnk"
"align=2048"
"MODgcw"
}
REQN
{
"config"
"MODgcw"
"shared"
}
}
The bnk section will look for ASFX and SFX files. However, SFX files are not useful in this instance since we're not making a new common.bnk, these sounds are to be munged and loaded directly from the sound.lvl
The next step is top open up the ASFX file in Notepad. It should be blank. All this will be is a list referring to the .wav files. All that needs to be is thus:
You can also add -resample pc 22050 (changing 22050 to whatever you want) but if the wavs are already 22khz this is not needed.effects\whatever_the_sound_is_called.wav
Now comes the 'fun' part - the SND files. Open shared.snd. Windows will try to open these in Windows Media Player, but they are, in fact, just text files, so you open these with Notepad also.
This is the 'fun' part because you have to figure out which settings are appropriate for the sound you want to implement.
In this instance I find it much easier to just find one of the stock SND files, open it, look for a sound that is similar to the one you're looking for. In this example we are going to implement a custom death sound SFX.
So find imp_unit.snd in the sound/gcw folder Any of the sounds that inherit from "imp_inf_pain_vo" will be fine to copy into your snd file.
IE:
Code: Select all
SoundProperties()
{
Name("imp_inf_com_chatter_death");
Group("imp_inf_pain_vo");
Inherit("pain_chatter_template");
PlayInterval(0.0);
PlayIntervalDev(0.0);
PlayProbability(1.0);
SampleList()
{
Sample("IICOM419", 0.33);
Sample("IICOM420", 0.33);
Sample("IICOM421", 0.33);
}
}
-The 'name' of the sound
-The samples called in the list.
Name is easy. Just change it to whatever you want to. You can then paste that name into your ODF files' DeathSound line.
The sample list is a tad more complicated.
You have these values bracketed under it:
Code: Select all
Sample("IICOM419", 0.33);
Sample("IICOM420", 0.33);
Sample("IICOM421", 0.33);
Let's say this is what's in the ASFX file:
You'll want all of those to be called into the SND, and all equally 'weighted'.effects\LEGO_FALLAPART1.wav
effects\LEGO_FALLAPART2.wav
effects\LEGO_FALLAPART3.wav
effects\LEGO_FALLAPART4.wav
effects\LEGO_FALLAPART5.wav
So your sample list will end up looking like this:
Code: Select all
Sample("LEGO_FALLAPART1", 0.2);
Sample("LEGO_FALLAPART2", 0.2);
Sample("LEGO_FALLAPART3", 0.2);
Sample("LEGO_FALLAPART4", 0.2);
Sample("LEGO_FALLAPART5", 0.2);
Open up the soundmungedir.bat file
Find this line:
Code: Select all
for /R %%A in (*.sfx) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ %CHECKDATE% -resample %CHECKID% noabort %SOUNDOPT% %BANKOPT% 2>>%MUNGE_LOG% 1>>%SOUNDLOGOUT%
Code: Select all
for /R %%A in (*.asfx) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ %CHECKDATE% -resample -checkid noabort %SOUNDOPT% 2>>%MUNGE_LOG% 1>>%SOUNDLOGOUT%
Next find BF2_ModTools\data\ _BUILD\sound\munge.bat, open that, find this line:
Code: Select all
@for /R %%A in (*.sfx) do @set BANKLIST=!BANKLIST! %%A
Code: Select all
@for /R %%A in (*.asfx) do @set BANKLIST=!BANKLIST! %%A
Code: Select all
@call soundmungedir _BUILD\sound\worlds\snd\%MUNGE_DIR% sound\worlds\snd sound\worlds\snd\%MUNGE_PLATFORM% %MUNGE_PLATFORM% _BUILD _LVL_%MUNGE_PLATFORM%\sound _BUILD\sound snd
The last step is calling it in your LUA. Find this:
Code: Select all
ReadDataFile("sound\\tat.lvl;tat2gcw")
Code: Select all
ReadDataFile("dc:sound\\MOD.lvl;MODgcw")
Munge, test... and if your sounds work (there is a chance that a sound will not play if it's not in the correct format but usually the munger catches that), then that's it!
(NOTE: I am not able to test the munged sounds directly myself since I cannot get munged maps to even run in SWBF2 - however, the steps I have outlined produce a functioning sound file)