(FAQ) Sound editing and you

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

(FAQ) Sound editing and you

Post by Maveritchell »

Custom sounds? No problem. This tutorial will explain the layout you should use for any custom sound and explain why you are doing what you are doing instead of laying out the steps for any specific type of sound editing (although a little bit here or there may be touched on).

This is not a comprehensive tutorial! To refer to specifics of how each type of sound is set up, you should reference the stock sounds. Once you know what each thing means (which is the goal of this tutorial), understanding should flow easily.

Sounds are all set up in a hierarchy. There are two main branches to this hierarchy: streams and effects.

Streams are, for the most part, going to be the "longer" pieces of music/audio that you'd use for ambient environment sounds, voices, or ambient music.

Effects are the shorter sounds used for ordnance and vehicles.

There are four "types" of files loaded in sound .req files:
"str" files (which are all .stm [and maybe .st4; that might be used more for ambient envfx or might be obsolete] files), "bnk" files (which are all .sfx and .asfx files), "config" files (which is most everything else, .snd, .mus) and then "lvl" (other .req files; "children").

Both of these (streams and effects)- if you've correctly set up a sound folder (or looked at stock sound folders for example) - will have corresponding folders of their own in your "data_ABC\Sound\worlds\ABC" folder, as seen here:
Hidden/Spoiler:
Image
In each of those folders you will need to put your .wav files, formatted to:
352 kbps, 16 bit, mono, 22 kHz PCM

Weapon sounds (as seen in this tutorial) need to go in "effects."
Ambient sounds (as seen in this tutorial or this tutorial) need to go in "streams."

The streams hierarchy works like this:
.wav files -> .stm file -> config file(s)
What does this mean? Here is an example "ABC.req" (main .req file)
ucft
{
REQN
{
"str"
"align=2048"
"ABC_stream"
}
REQN
{
"lvl"
"ABCgcw"
}
}
In this file, "ABC_stream" (under "str") is the .stm file and "ABCgcw" is the "child" .req (era .req). "ABC_stream.stm" references our .wav file (named "ABC_amb_1.wav") like this:
streams\ABC_amb_1.wav ABC_stream_name -resample xbox 22050 pc 22050
You can see that it "renames" it to "ABC_stream_name" which is referenced later.

Next, inside the "ABCgcw.req" file, you'll see something like this:
ucft
{
REQN
{
"bnk"
"align=2048"
}

REQN
{
"config"
"ABCgcw_music_config"
"ABCgcw_music"
}
}
In this file, nothing is loaded under "bnk" (no .sfx or .asfx for streams). "ABCgcw_music_config" is a .snd file and "ABCgcw_music" is an .mus file - for ambient music, these must be loaded in this order in the .req (as the .mus file references the .snd file).

"ABCgcw_music_config.snd" references "ABC_stream.snd" here:
SoundStream()
{
Name("ABC_stream_name");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
Stream("ABC_stream");
SegmentList()
{
Segment("ABC_stream_name", 1.0);
}
}
Then, "ABCgcw_music.mus" references "ABCgcw_music_config.snd" here:
Music()
{
Name("ABC_stream_name");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.5);
MinPlaybackTime(20.0);
MaxPlaybackTime(300.0);
MinInactiveTime(2.0);
SoundStream("ABC_stream_name");
}
Your name here is going to be the one referenced in the .lua in "SetAmbientMusic". So you can see how each reference trickles down.

The same happens with effects. The hierarchy for effects is this:
.wav files -> .asfx (what you will use for custom effects) files -> config files
Our .wav sound will be the explosion sound "combust.wav" for this example. Here is your parent "ABC.req;" note that all this does for us right now is load the child .req:
ucft
{
REQN
{
"str"
"align=2048"
}
REQN
{
"lvl"
"ABCgcw"
}
}
In the child "ABCgcw.req", we have this:
ucft
{
REQN
{
"bnk"
"align=2048"
"ABC_effects"
}

REQN
{
"config"
"ABC_wconfig"
}
}
Note that now we load the next in the hierarchy - "ABC_effects.asfx" - next. It references our "combust.wav" here:
effects\combust.wav -resample xbox 22050 pc 22050
Next loaded is the config file "ABC_wconfig.snd". It references the "ABC_effects.asfx" file here:
SoundProperties()
{
Name("combust");
Group("explosion");
Inherit("explosion_template");
MinDistance(5.0)
MaxDistance(60)
MuteDIstance(60)
RollOff(1.0)
SampleList()
{
Sample("combust", 1.0);
}
}
The name given up top (also "combust") is the name to be referenced in an .odf.

The last part of setting up sounds (and separate from the hierarchy above) is going to be loading them in the .lua. Effects can always be loaded simply by the basic dc:sound call, e.g.
ReadDataFile("dc:sound\\ABC.lvl;ABCgcw")
This is mentioned in greater detail in every other tutorial on the site, make sure you look at them too.
Streams (since the .stm file is referenced in the main .req and not in the child .req like everything else) need to have an additional reference (they also need the above reference) in the .lua. This is usually further down in the .lua (and is also mentioned in greater detail in other tutorials on the site). It looks something like this:
OpenAudioStream("dc:sound\\ABC.lvl", "ABC_stream")
One final word!
All of this can be done in the SWBF2 tools, but by default this is not made available to you.
There are three files you need to fix to make your tools work.
Download the following .zip file and place the files inside where directed below:
MediaFire

First: "munge.bat" to "data_ABC\_BUILD\Sound".

Second: "soundmungedir.bat" to "data_ABC".

Third: "soundmunge.bat" to "data_ABC" - edit this first, though:
You will need to edit "soundmunge.bat":
Open it and replace all instances of "ABC" with your three-letter map name.

Once you've done those three, you're good to go.

*This builds on previous tutorials.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: (FAQ) Sound editing and you

Post by Fiodis »

Thank you, Maveritchell. I always prefer tutorials that explain things rather than just laying out the steps, and this is one I like.
obiboba3po
2008 Most Technically Challenging Avatar
Posts: 2376
Joined: Tue Feb 12, 2008 7:46 pm
Projects :: No Mod project currently.
Games I'm Playing :: League of Legends
xbox live or psn: No gamertag set
Location: NJ, USA

Re: (FAQ) Sound editing and you

Post by obiboba3po »

Thank youuu mav :thumbs: This is the thing i have on my "to do list for modding" this summer so thanks a bunch
Theres a question ive always had about sounds. How exactly do you ensure that a .wav file fits these requirements? 352 kbps, 16 bit, mono, 22 kHz PCM I would just make a normal.wav and try it but im not exactly sure
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: (FAQ) Sound editing and you

Post by Maveritchell »

obiboba3po wrote:Thank youuu mav :thumbs: This is the thing i have on my "to do list for modding" this summer so thanks a bunch
Theres a question ive always had about sounds. How exactly do you ensure that a .wav file fits these requirements? 352 kbps, 16 bit, mono, 22 kHz PCM I would just make a normal.wav and try it but im not exactly sure
Your audio editing program should allow you to set this up somewhere; I always run my audio files through ITunes, whose exporting options let me set that up very specifically.
obiboba3po
2008 Most Technically Challenging Avatar
Posts: 2376
Joined: Tue Feb 12, 2008 7:46 pm
Projects :: No Mod project currently.
Games I'm Playing :: League of Legends
xbox live or psn: No gamertag set
Location: NJ, USA

Re: (FAQ) Sound editing and you

Post by obiboba3po »

Maveritchell wrote:
obiboba3po wrote:Thank youuu mav :thumbs: This is the thing i have on my "to do list for modding" this summer so thanks a bunch
Theres a question ive always had about sounds. How exactly do you ensure that a .wav file fits these requirements? 352 kbps, 16 bit, mono, 22 kHz PCM I would just make a normal.wav and try it but im not exactly sure
Your audio editing program should allow you to set this up somewhere; I always run my audio files through ITunes, whose exporting options let me set that up very specifically.
Where exactly are you going in Itunes to export songs? The only exporting ive ever been able to do is export playlist which in itself doesn't usually work right.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: (FAQ) Sound editing and you

Post by Maveritchell »

obiboba3po wrote:Where exactly are you going in Itunes to export songs? The only exporting ive ever been able to do is export playlist which in itself doesn't usually work right.
:google:
You rightclick on a song and click "convert selection to ___" (in this case .wav). This is of course after you've set up your preferences (advanced->importing) to WAV, 22.050kHz, 16-bit, Mono.
obiboba3po
2008 Most Technically Challenging Avatar
Posts: 2376
Joined: Tue Feb 12, 2008 7:46 pm
Projects :: No Mod project currently.
Games I'm Playing :: League of Legends
xbox live or psn: No gamertag set
Location: NJ, USA

Re: (FAQ) Sound editing and you

Post by obiboba3po »

Maveritchell wrote:
obiboba3po wrote:Where exactly are you going in Itunes to export songs? The only exporting ive ever been able to do is export playlist which in itself doesn't usually work right.
:google:
You rightclick on a song and click "convert selection to ___" (in this case .wav). This is of course after you've set up your preferences (advanced->importing) to WAV, 22.050kHz, 16-bit, Mono.
Ah i see that hepled. Thanks very much Mav :)
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: (FAQ) Sound editing and you

Post by Deviss »

and how is the lines for add jetpack sound??


SoundProperties()
{
Name("jetpack");
Group("???");
Inherit("???");
SampleList()
{
Sample("comjetpack", 1.0);
}
}
thanks :)
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: (FAQ) Sound editing and you

Post by Maveritchell »

Like I said, look in the stock sound assets for examples. I can't possibly tell everyone how to do everything. Most weapon (etc.) sound setups are located in the global_world.snd file:
Hidden/Spoiler:
[code]// Jetpack Engine start------------------------------------------------------------
SoundProperties()
{
Name("rep_weap_jetpack_turnon");
Pitch(1.1);
PitchDev(0.1);
Gain(0.7);
GainDev(0.05);
ReverbGain(1.0);
Bus("soundfx");
Looping(0);
Pan(0.0);
MinDistance(10.0);
MuteDistance(50.0);
MaxDistance(50.0);
RollOff(2.0);
Mode3D(1);
Bias(0.0001);
Priority(0.9);
SampleList()
{
Sample("rep_weap_jetpack_turnon", 1.0);
}
}
SoundProperties()
{
Name("rep_weap_jetpack_turnoff");
Pitch(1.1);
PitchDev(0.1);
Gain(0.6);
GainDev(0.05);
ReverbGain(1.0);
Bus("soundfx");
Looping(0);
Pan(0.0);
MinDistance(10.0);
MuteDistance(50.0);
MaxDistance(50.0);
RollOff(2.0);
Mode3D(1);
Bias(0.0001);
Priority(0.8);
SampleList()
{
Sample("rep_weap_jetpack_turnoff", 1.0);
}
}

SoundProperties()
{
Name("rep_inf_Jetpack_engine_parameterized");
Pitch(1.0);
PitchDev(0.1);
Gain(0.7);
GainDev(0.1);
ReverbGain(1.0);
Bus("soundfx");
Looping(1);
Pan(0.0);
MinDistance(10.0);
MuteDistance(100.0);
MaxDistance(100.0);
RollOff(2.0);
Mode3D(1);
Bias(0.0001);
Priority(0.8);
SampleList()
{
Sample("rep_inf_jetpack", 1.0);

}
}

ParameterGraph()
{
Name("Jetpackengine_speed");
ControlPoint(0.0, 0.9);
ControlPoint(1.0, 1.0);
}

ParameterGraph()
{
Name("Jetpackengine_acceleration");
ControlPoint(-0.1, 0.5);
ControlPoint(0.0, 0.4);
ControlPoint(0.1, 0.5);
ControlPoint(0.2, 0.6);
ControlPoint(0.4, 0.7);
ControlPoint(0.6, 0.8);
ControlPoint(0.8, 0.9);
ControlPoint(1.0, 1.0);
}

SoundLayered()
{
Name("Jetpackengine_layered");
Layer("Jetpack_engine", "rep_inf_Jetpack_engine_parameterized", 0.0);
}

SoundParameterized()
{
Name("rep_inf_Jetpack_engine_parameterized");
SoundLayered("Jetpackengine_layered");
Layer()
{
Name("Jetpack_engine");
ParameterGraph("speed", "Jetpackengine_speed", "pitch");
ParameterGraph("acceleration", "Jetpackengine_acceleration", "gain");
}
}

//Jetpack Engine End--------------------------------------------------------------[/code]
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: (FAQ) Sound editing and you

Post by Deviss »

Maveritchell wrote:Like I said, look in the stock sound assets for examples. I can't possibly tell everyone how to do everything. Most weapon (etc.) sound setups are located in the global_world.snd file:
Hidden/Spoiler:
[code]// Jetpack Engine start------------------------------------------------------------
SoundProperties()
{
Name("rep_weap_jetpack_turnon");
Pitch(1.1);
PitchDev(0.1);
Gain(0.7);
GainDev(0.05);
ReverbGain(1.0);
Bus("soundfx");
Looping(0);
Pan(0.0);
MinDistance(10.0);
MuteDistance(50.0);
MaxDistance(50.0);
RollOff(2.0);
Mode3D(1);
Bias(0.0001);
Priority(0.9);
SampleList()
{
Sample("rep_weap_jetpack_turnon", 1.0);
}
}
SoundProperties()
{
Name("rep_weap_jetpack_turnoff");
Pitch(1.1);
PitchDev(0.1);
Gain(0.6);
GainDev(0.05);
ReverbGain(1.0);
Bus("soundfx");
Looping(0);
Pan(0.0);
MinDistance(10.0);
MuteDistance(50.0);
MaxDistance(50.0);
RollOff(2.0);
Mode3D(1);
Bias(0.0001);
Priority(0.8);
SampleList()
{
Sample("rep_weap_jetpack_turnoff", 1.0);
}
}

SoundProperties()
{
Name("rep_inf_Jetpack_engine_parameterized");
Pitch(1.0);
PitchDev(0.1);
Gain(0.7);
GainDev(0.1);
ReverbGain(1.0);
Bus("soundfx");
Looping(1);
Pan(0.0);
MinDistance(10.0);
MuteDistance(100.0);
MaxDistance(100.0);
RollOff(2.0);
Mode3D(1);
Bias(0.0001);
Priority(0.8);
SampleList()
{
Sample("rep_inf_jetpack", 1.0);

}
}

ParameterGraph()
{
Name("Jetpackengine_speed");
ControlPoint(0.0, 0.9);
ControlPoint(1.0, 1.0);
}

ParameterGraph()
{
Name("Jetpackengine_acceleration");
ControlPoint(-0.1, 0.5);
ControlPoint(0.0, 0.4);
ControlPoint(0.1, 0.5);
ControlPoint(0.2, 0.6);
ControlPoint(0.4, 0.7);
ControlPoint(0.6, 0.8);
ControlPoint(0.8, 0.9);
ControlPoint(1.0, 1.0);
}

SoundLayered()
{
Name("Jetpackengine_layered");
Layer("Jetpack_engine", "rep_inf_Jetpack_engine_parameterized", 0.0);
}

SoundParameterized()
{
Name("rep_inf_Jetpack_engine_parameterized");
SoundLayered("Jetpackengine_layered");
Layer()
{
Name("Jetpack_engine");
ParameterGraph("speed", "Jetpackengine_speed", "pitch");
ParameterGraph("acceleration", "Jetpackengine_acceleration", "gain");
}
}

//Jetpack Engine End--------------------------------------------------------------[/code]
Many thanks sir :bowdown:
ZappelClone
Private Recruit
Posts: 22
Joined: Fri May 07, 2010 11:05 am

Re: (FAQ) Sound editing and you

Post by ZappelClone »

first of all id like to thank you for this tutorial..i really like your style and the way youre actually explaining things rather than just giving instructions.

nevertheless iam struggling with the rain sound from the kamino assets.
the effects/streams folders are both empty and i cannot find the .wavs.
my system runs with vista( :cpu: ) and iam using the bf2 mod tools.
what i did so far was copying the sound assets from the kamino sound folder which appear to be responsible for the raining sound (the kam1.stm/.st4/.snds) and replaced every kam1 with my 3letter map id.
i followed your tut and i think that i have setup everything correctly..just the .wavs are missing.

btw i also downloaded the repaired munge/bat files and replaced the old ones.

help will be appreciated :runaway:
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: (FAQ) Sound editing and you

Post by Maveritchell »

None of the actual source sound files from the games are released - since so many of the sounds are not Pandemic's original assets (they were licensed out from Lucasarts/Lucasfilm from original Star Wars sound sources) they could not be.

To load any stock sound from the game you'll still need to create a sound .lvl, but it's easier in that you only have to load in the stock sounds from the preexisting compiled .lvl. Read through this tutorial:
http://www.gametoast.com/forums/viewtop ... =27&t=4750

It explains the overall process.

Additionally, if your map doesn't have vehicles, you may find it easier to simply load directly in the stock Kamino sound .lvl through your .lua (see stock Kamino .luas for examples)- if you don't need any sounds that it doesn't load, then you don't have to do any extra work.
ZappelClone
Private Recruit
Posts: 22
Joined: Fri May 07, 2010 11:05 am

Re: (FAQ) Sound editing and you

Post by ZappelClone »

thx for your advice:)...but i figured it out myself using the search function :angel:
i must have been so annoyed by this rain sound that just didnt want to appear, that i forgot to use the searchbutton earlier^^.

i used the lua method and added the com_snd_amb objects in ze like fragme explained in another thread...adds a nice "stereo-effect" to the rather quiet overall rain-sound.

(my next step will be creating an own sound file for my map starting with a copy of the (renamed) kamino sounds and trying to point out which parametres are neccessary for the rain sound and which not :thumbs: (wierd smileys in here))

but thx again for your reply
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: (FAQ) Sound editing and you

Post by Deviss »

how i set up spawn sound for one unit (no hero) ? :)
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: (FAQ) Sound editing and you

Post by Maveritchell »

Maveritchell wrote:This is not a comprehensive tutorial! To refer to specifics of how each type of sound is set up, you should reference the stock sounds. Once you know what each thing means (which is the goal of this tutorial), understanding should flow easily.
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: (FAQ) Sound editing and you

Post by Deviss »

Maveritchell wrote:
Maveritchell wrote:This is not a comprehensive tutorial! To refer to specifics of how each type of sound is set up, you should reference the stock sounds. Once you know what each thing means (which is the goal of this tutorial), understanding should flow easily.
ops so sorry wrong me :S
Post Reply