Page 1 of 4

(FAQ) Tentative custom ambient music tutorial

Posted: Wed Dec 19, 2007 12:15 am
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

Re: Tentative Custom Ambient Music Tutorial

Posted: Wed Dec 19, 2007 12:49 am
by MasterSaitek009
Very nice!
Bookmarking this.
Hmmm... I wonder how Relient K sound in tandem with E-11's...... :)

Re: Tentative Custom Ambient Music Tutorial

Posted: Wed Dec 19, 2007 6:05 am
by Eagle Eye
is this for changing the background music?

Re: Tentative Custom Ambient Music Tutorial

Posted: Wed Dec 19, 2007 8:07 am
by Teancum
Is there another kind? :P

Re: Tentative Custom Ambient Music Tutorial

Posted: Wed Dec 19, 2007 8:12 pm
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

Re: Tentative Custom Ambient Music Tutorial

Posted: Tue Feb 19, 2008 7:29 pm
by Fluffy_the_ic
wonder how attention, i write sin not tragedy, thnks fr th mmrs (sp?) would feel?

Re: Tentative Custom Ambient Music Tutorial

Posted: Tue Feb 19, 2008 7:48 pm
by Maveritchell
Fluffy_the_ic wrote:wonder how attention, i write sin not tragedy, thnks fr th mmrs (sp?) would feel?
Uh, what? Relevance?

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Feb 21, 2008 6:42 pm
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?

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Feb 21, 2008 8:07 pm
by Maveritchell
ITunes music is in protected AAC format. If you want it in .wav you have to do some converting.

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Mar 06, 2008 4:37 pm
by obiboba3po
what do u convert it 2? will mp3 files do?

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Mar 06, 2008 4:41 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Mar 06, 2008 4:45 pm
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)

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Mar 06, 2008 4:47 pm
by Aman/Pinguin

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Mar 06, 2008 4:48 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Fri Mar 07, 2008 1:41 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Wed Apr 16, 2008 11:13 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Wed Apr 16, 2008 11:18 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Apr 17, 2008 7:59 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Apr 17, 2008 8:08 pm
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.

Re: Tentative Custom Ambient Music Tutorial

Posted: Thu Apr 17, 2008 8:10 pm
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.