(FAQ) Tentative custom ambient music tutorial

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

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

(FAQ) Tentative custom ambient music tutorial

Post by Maveritchell »

Here is how you can use either the BF1 tools (or BF2 tools) to get your custom ambient music into the game.

Prepare your music files: You will need four music files (unless you're doing an assault-type map, in which case you only need two). These music files need to be formatted as .wav files - traditionally in 352 kbps, 16 bit, mono, 22 kHz PCM mode, but this is not required.

They need to be called "Music1.wav" (this is your "beginning ambient track, or your entire mix if you're doing an assault map), "Music2.wav" (this is your "middle" ambient track - unnecessary if you're doing an assault map), "Music3.wav" (this is your "end" ambient track - unnecessary if you're doing an assault map), and "victory.wav" (this is your "victory" track - plays on mission accomplished).

Note that if you're doing an assault map (and as such only have one track - which you will, because assault maps only read one ambient music file per side) when you finish Step 3, before you munge, you need to do the following:

Open the "efxcw_music.stm" file. Edit every reference to "Music2" and "Music3" to "Music1." That'll make sure the munge doesn't try and compile files that don't exist.

Set up the map:

1) Download the BF1 Modtools. I can't make custom ambient music munge in the BF2 tools, even with the fixed munge.bat and soundmungedir.bat (+etc.).

2) Create a new world. For the purpose of this tutorial we'll call it "EFX"

3) Go to the newly munged "EFX" folder, continue to the "Sound" folder and then into the "worlds" folder. (C:\Lucasarts\BFBuilder\DataEFX\Sound\worlds). Place the "EFX" folder that you can download at the end of this tut in there (overwriting previous files).

4) Munge the world (in BFBuilder) and leave it alone for now.

5) Now open up the .lua file of the BF2 map you want to edit. Find where the .lua says:

Code: Select all

ReadDataFile("sound\\tat.lvl;tat2gcw")
This should be right above the first ReadDataFile for your sides. Above the previously mentioned line, add in:

Code: Select all

ReadDataFile("dc:sound\\efx.lvl;efxcw")
6) Now scroll down further in the .lua, past the memorypools, and find where the .lua says:

Code: Select all

OpenAudioStream("sound\\global.lvl",  "gcw_music")
(Note: this may reference cw_music if this is a CW mode.) Above that line insert the line:

Code: Select all

OpenAudioStream("dc:sound\\efx.lvl",  "efxcw_music")
7) Find where your .lua says:

Code: Select all

    SetAmbientMusic(REP, 1.0, "rep_yav_amb_start",  0,1)
    SetAmbientMusic(REP, 0.8, "rep_yav_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.2, "rep_yav_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "cis_yav_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.8, "cis_yav_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.2, "cis_yav_amb_end",    2,1)
(Note: this will reference "all" and "imp" if the mode is GCW.) Overtop of those lines, insert the following:

Code: Select all

    SetAmbientMusic(ALL, 1.0, "rep_kam_amb_start",  0,1);
    SetAmbientMusic(ALL, 0.99, "rep_kam_amb_middle", 1,1);
    SetAmbientMusic(ALL, 0.1,"rep_kam_amb_end",    2,1);
    SetAmbientMusic(IMP, 1.0, "cis_kam_amb_start",  0,1);
    SetAmbientMusic(IMP, 0.99, "cis_kam_amb_middle", 1,1);
    SetAmbientMusic(IMP, 0.1,"cis_kam_amb_end",    2,1);

    SetVictoryMusic(ALL, "rep_kam_amb_victory")
    SetDefeatMusic (ALL, "all_tat_amb_defeat")
    SetVictoryMusic(IMP, "cis_kam_amb_victory")
    SetDefeatMusic (IMP, "imp_tat_amb_defeat")
(Note, if you're creating a single track that will play through the entire level (you will be doing this if your map is not conquest mode), then insert the following instead:

Code: Select all

    SetAmbientMusic(ALL, 1.0, "rep_kam_amb_start",  0,1);
    --SetAmbientMusic(ALL, 0.99, "rep_kam_amb_middle", 1,1);
    --SetAmbientMusic(ALL, 0.1,"rep_kam_amb_end",    2,1);
    SetAmbientMusic(IMP, 1.0, "cis_kam_amb_start",  0,1);
    --SetAmbientMusic(IMP, 0.99, "cis_kam_amb_middle", 1,1);
    --SetAmbientMusic(IMP, 0.1,"cis_kam_amb_end",    2,1);

    SetVictoryMusic(ALL, "rep_kam_amb_victory")
    SetDefeatMusic (ALL, "all_tat_amb_defeat")
    SetVictoryMusic(IMP, "cis_kam_amb_victory")
    SetDefeatMusic (IMP, "imp_tat_amb_defeat")
8) You've done all the work to your BF2 map you need to. Run VisualMunge and munge your map.

9) Go back to the BFBuilder folder. Go to its "AddOn" directory. Go to "AddOn\EFX\Data\_lvl_pc\sound" and copy the efx.lvl you find in there.

10) Go to your "C:\Program Files\LucasArts\Star Wars Battlefront II\GameData\addon" folder (BF2 addons) and open your mapname (MODID) folder. Continue to "Star Wars Battlefront II\GameData\addon\MODID\data\_LVL_PC". Create a "sound" folder. In that folder, paste the efx.lvl you copied earlier.

11) Run your map (no further munging necessary).

---

Important! Download the following file, it contains the "EFX" folder you need for this tut:

MediaFire
MasterSaitek009
Black Sun Slicer
Posts: 619
Joined: Wed Aug 23, 2006 4:10 pm

Re: Tentative Custom Ambient Music Tutorial

Post by MasterSaitek009 »

Very nice!
Bookmarking this.
Hmmm... I wonder how Relient K sound in tandem with E-11's...... :)
User avatar
Eagle Eye
First Lance Corporal
First Lance Corporal
Posts: 129
Joined: Thu Nov 01, 2007 12:44 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Belgium
Contact:

Re: Tentative Custom Ambient Music Tutorial

Post by Eagle Eye »

is this for changing the background music?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Tentative Custom Ambient Music Tutorial

Post by Teancum »

Is there another kind? :P
User avatar
phazon_elite
Rebel Colonel
Rebel Colonel
Posts: 597
Joined: Tue Jan 16, 2007 9:10 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: I'm sorry Link, I can't give the location. Come back when you're a little...mmmh...RICHER!
Contact:

Re: Tentative Custom Ambient Music Tutorial

Post by phazon_elite »

Lol, thanks Mav for making a tut for this. As you probably know, I had that tut that was about half done, but I believe I lost it...

Anyway, this should help a bunch more when it's finished!

- EP-782
User avatar
Fluffy_the_ic
Hoth Battle Chief
Hoth Battle Chief
Posts: 3223
Joined: Thu Jan 24, 2008 7:03 pm
Projects :: astrally
xbox live or psn: fluffytherc
Location: he/him

Re: Tentative Custom Ambient Music Tutorial

Post by Fluffy_the_ic »

wonder how attention, i write sin not tragedy, thnks fr th mmrs (sp?) would feel?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Tentative Custom Ambient Music Tutorial

Post by Maveritchell »

Fluffy_the_ic wrote:wonder how attention, i write sin not tragedy, thnks fr th mmrs (sp?) would feel?
Uh, what? Relevance?
User avatar
Fluffy_the_ic
Hoth Battle Chief
Hoth Battle Chief
Posts: 3223
Joined: Thu Jan 24, 2008 7:03 pm
Projects :: astrally
xbox live or psn: fluffytherc
Location: he/him

Re: Tentative Custom Ambient Music Tutorial

Post by Fluffy_the_ic »

Maveritchell wrote:Uh, what? Relevance?
If you're asking if this is relevant, then, I guess you can say it is. I was saying "I wonder how three of my favorite songs would sound in game?". Haven't had time to try it out yet, though. And are songs on iTunes .wav files?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Tentative Custom Ambient Music Tutorial

Post by Maveritchell »

ITunes music is in protected AAC format. If you want it in .wav you have to do some converting.
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: Tentative Custom Ambient Music Tutorial

Post by obiboba3po »

what do u convert it 2? will mp3 files do?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Tentative Custom Ambient Music Tutorial

Post by Maveritchell »

obiboba3po wrote:what do u convert it 2? will mp3 files do?
Did you even read the tutorial? In bold, right up near the top:
Maveritchell wrote:Prepare your music files: You will need four music files (unless you're doing an assault-type map, in which case you only need two). These music files need to be .wav files in 352 kbps, 16 bit, mono, 22 kHz PCM mode.
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: Tentative Custom Ambient Music Tutorial

Post by obiboba3po »

ya i know and i have a converting program called media coder and it can convert to something called wavpack, and i dont know what this is. is there a specific converting program i should use??
(i did read the whole tut)
Aman/Pinguin
Jedi
Jedi
Posts: 1104
Joined: Tue Jan 30, 2007 6:04 am
Projects :: Inactive
Location: Germany

Re: Tentative Custom Ambient Music Tutorial

Post by Aman/Pinguin »

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

Re: Tentative Custom Ambient Music Tutorial

Post by Maveritchell »

obiboba3po wrote:it can convert to something called wavpack
I have no idea what a "wavpack" file is, but it needs to be in .wav. Like I said in the tutorial. You can use many different apps to do this, but I like to use ITunes just because it's really easy.
User avatar
tsurugi13
Lieutenant Colonel
Lieutenant Colonel
Posts: 543
Joined: Mon Dec 17, 2007 6:16 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Battling the ISA menace on Helghan.

Re: Tentative Custom Ambient Music Tutorial

Post by tsurugi13 »

An easy way to create a .wav file is just using the sound recorder program that comes with windows. All you need to do is set the default recording device to your speakers and play what you want to record. The only downside is the 1 min. recording length.
User avatar
SBF_Dann_Boeing
Groove Walrus
Groove Walrus
Posts: 1529
Joined: Wed Aug 31, 2005 11:33 pm
xbox live or psn: No gamertag set
Location: An Igloo High Upon a Mountain Top

Re: Tentative Custom Ambient Music Tutorial

Post by SBF_Dann_Boeing »

I've set up my stuff in bf1_modtools, but when i munge, no sound folder or lvl shows up where it should be. I try the actual munge.bat in _Build_PC\sound, i get

Image

LSD.req
Hidden/Spoiler:
[code]ucft
{
REQN
{
"str"
"align=2048"
"lsdcw_music" //.stm
"lsdgcw_music" //.stm
}
REQN
{
"lvl"
"lsdcw" //.req
"lsdgcw" //.req
}

}[/code]
LSDcw.req
Hidden/Spoiler:
[code]ucft
{
REQN
{
"bnk"
"align=2048"
}

REQN
{
"config"
"lsdcw_music_config" //.snd
"lsdcw_music" //.mus
}
}[/code]
LSDgcw.req
Hidden/Spoiler:
[code]ucft
{
REQN
{
"bnk"
"align=2048"
}

REQN
{
"config"
"lsdgcw_music_config" //.snd
"lsdgcw_music" //.mus
}
}[/code]
Tell me if you want to see anything more.
Last edited by SBF_Dann_Boeing on Thu Apr 17, 2008 10:04 pm, edited 2 times in total.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Tentative Custom Ambient Music Tutorial

Post by Maveritchell »

It'd probably be easiest if you just uploaded your sound folder, but barring that, I'd like to see your .stm and .mus files.
User avatar
SBF_Dann_Boeing
Groove Walrus
Groove Walrus
Posts: 1529
Joined: Wed Aug 31, 2005 11:33 pm
xbox live or psn: No gamertag set
Location: An Igloo High Upon a Mountain Top

Re: Tentative Custom Ambient Music Tutorial

Post by SBF_Dann_Boeing »

lsdcw_music.mus
Hidden/Spoiler:
[code]Music()
{
Name("rep_lsd_amb_start");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(480.0);
MinInactiveTime(0.0);
SoundStream("rep_lsd_amb_start");
}

Music()
{
Name("rep_lsd_amb_victory");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(12.0);
MinInactiveTime(5.0);
SoundStream("rep_lsd_amb_victory");
}

Music()
{
Name("rep_lsd_amb_defeat");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(12.0);
MinInactiveTime(5.0);
SoundStream("rep_lsd_amb_defeat");
}
[/code]
lsdgcw_music.mus
Hidden/Spoiler:
[code]
Music()
{
Name("imp_lsd_amb_start");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(480.0);
MinInactiveTime(0.0);
SoundStream("imp_lsd_amb_start");
}

Music()
{
Name("imp_lsd_amb_victory");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(12.0);
MinInactiveTime(5.0);
SoundStream("imp_lsd_amb_victory");
}

Music()
{
Name("imp_lsd_amb_defeat");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(12.0);
MinInactiveTime(5.0);
SoundStream("imp_lsd_amb_defeat");
}
[/code]
lsdcw_music.stm
Hidden/Spoiler:
[code]Streams\peppy5.wav rep_lsd_amb_start
Streams\peppy6.wav rep_lsd_amb_start01
Streams\peppy7.wav rep_lsd_amb_start02
Streams\peppy8.wav rep_lsd_amb_start03
Streams\victory2.wav rep_lsd_amb_victory
Streams\DEFEAT2.wav rep_lsd_amb_defeat
[/code]
lsdgcw_music.stm
Hidden/Spoiler:
[code]
Streams\peppy1.wav imp_lsd_amb_start
Streams\peppy2.wav imp_lsd_amb_start01
Streams\peppy3.wav imp_lsd_amb_start02
Streams\peppy4.wav imp_lsd_amb_start03
Streams\victory.wav imp_lsd_amb_victory
Streams\DEFEAT.wav imp_lsd_amb_defeat
[/code]
lsdcw_music_config.snd
Hidden/Spoiler:
[code]SoundStream()
{
Name("rep_lsd_amb_start");
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("lsdcw_music"); //.stm file
SegmentList()
{
Segment("rep_lsd_amb_start", 1.0);
Segment("rep_lsd_amb_start02", 1.0);
Segment("rep_lsd_amb_start03", 1.0);
Segment("rep_lsd_amb_start04", 1.0);
}
}

SoundStream()
{
Name("rep_lsd_amb_victory");
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("lsdcw_music");
SegmentList()
{
Segment("rep_lsd_amb_victory", 1.0);
}
}

SoundStream()
{
Name("rep_lsd_amb_defeat");
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("lsdcw_music");
SegmentList()
{
Segment("rep_lsd_amb_defeat", 1.0);
}
}[/code]
lsdgcw_music_config.snd
Hidden/Spoiler:
[code]SoundStream()
{
Name("imp_lsd_amb_start");
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("lsdgcw_music"); //.stm file
SegmentList()
{
Segment("imp_lsd_amb_start", 1.0);
Segment("imp_lsd_amb_start01", 1.0);
Segment("imp_lsd_amb_start02", 1.0);
Segment("imp_lsd_amb_start03", 1.0);
}
}

SoundStream()
{
Name("imp_lsd_amb_victory");
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("lsdgcw_music");
SegmentList()
{
Segment("imp_lsd_amb_victory", 1.0);
}
}

SoundStream()
{
Name("imp_lsd_amb_defeat");
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("lsdgcw_music");
SegmentList()
{
Segment("imp_lsd_amb_defeat", 1.0);
}
}[/code]
This set up is something that I worked on with phazon elite to have 4 wav's play at random from the beginning of the map to the end. Until now, phazon elite has always done it for me. He then instructed me how to set it up the way he does. However, now I'm encountering the old problem of it refusing to munge.
User avatar
phazon_elite
Rebel Colonel
Rebel Colonel
Posts: 597
Joined: Tue Jan 16, 2007 9:10 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: I'm sorry Link, I can't give the location. Come back when you're a little...mmmh...RICHER!
Contact:

Re: Tentative Custom Ambient Music Tutorial

Post by phazon_elite »

Hmm, looks fine to me. Maybe it's your // comments. I'm not sure if the mod tools can recognize // comments when munging sound files.

EDIT: Forget that, I found your problem. In your CW .snd file, you have start, start2, start3, and start4. In your CW .stm, you have start, start1, start2, and start3.
Last edited by phazon_elite on Thu Apr 17, 2008 8:11 pm, edited 1 time in total.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Tentative Custom Ambient Music Tutorial

Post by Maveritchell »

phazon_elite wrote:Hmm, looks fine to me. Maybe it's your // comments. I'm not sure if the mod tools can recognize // comments when munging sound files.
Those are my commented-out sections, and I'm fairly sure that they're not an issue. I kept them in there while I learned how to set this up to keep myself straight. (It can't hurt to check, and you're welcome to, I just doubt it'll do anything - although I'd be happy to be both wrong and confused.)

Dann, I'll look it over and compare it to my setup a little later.
Post Reply