TUTORIAL - Adding custom audio to shipped game

Post everything from general questions, to modding questions, to map WIPs to releases. (SWBF1 only)

Moderator: Moderators

Post Reply
User avatar
giftheck
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2218
Joined: Mon Jan 19, 2009 5:58 pm
Projects :: Star Wars Battlefront Anniversary

TUTORIAL - Adding custom audio to shipped game

Post by giftheck »

This is a tutorial on how to add custom audio to the main game. It is based off Maveritchell's BF2 custom audio tut. Note this is for the BF1 MAIN GAME but steps can be used to make audio in your maps too.

WHAT YOU NEED:

1) Star Wars Battlefront Mod Tools
2)Main game mission.lvl builder
3)A good audio editor. I recommend GoldWave, I use version 4.25, so I will demonstrate commands from that version.

STEP 1 - Sound Creation

Create a new map. For the purposes of this tut I will call it kam2.

Copy the contents of the Shipped Sound Config/Worlds/kam into the Datakam2/sound/worlds/kam2.

Open kam2.req, and copy the contents of kam.req into there.

Make your audio files. However, to be on the safe side, DO NOT HIT THE PASTE NEW BUTTON - It may save the files as an incorrect type. I found this when experimenting using the MP3s made from the Star Wars Special Edition releases, and the Force Unleashed promo tracks - they will not munge and the game will ignore your sound lvl file. Open a blank sound and the New Sound window will open. Choose the CD preset. Paste your changes into this blank file. Use the file "kamcw_music.stm" to show you what names you need to save the audio as.

SAVE THE FILE. 16bit .wav audio, 44100hz PCM, in the "samples" folder.

Compile the map, and you'll get the desired kam2.lvl file in _lvl_pc/sound. Copy it into your MAIN GAME sound folder.

STEP 2 - Adding to the main game

Open the mission.lvl editor, find the .lua for Kamino, "kam1c.lua". Open it and find the line:

Code: Select all

ReadDataFile("sound\\kam.lvl;kam1cw");
Above that line, place this line:

Code: Select all

ReadDataFile("sound\\kam2.lvl;kam1cw");
Find this line:

Code: Select all

OpenAudioStream("sound\\kam.lvl",  "kamcw_music");
And add this above that line.

Code: Select all

OpenAudioStream("sound\\kam2.lvl",  "kamcw_music");
STEP 3 - Copy and play

BACK UP THE MISSION.LVL IN YOUR MAIN FOLDER BEFORE DOING THIS.

Now save the file "kam1c.lua", and use the mission.lvl editor's munge command. Go into the _lvl_pc folder, where you will find the new script. Copy it into your shipped _lvl_pc/sound folder, and play to test!

RULES:

No looping as of yet. i tried to loop but the loops didn't play. If you want to loop it has to be looped and faded out in the sound itself.
Last edited by giftheck on Sat Jan 24, 2009 6:19 pm, edited 1 time in total.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: TUTORIAL - Adding custom audio to shipped game

Post by Maveritchell »

...

My tutorial (or Vyse's tutorial, the one I based mine off of) uses the BF1 tools. You don't need another tutorial, because those are for SWBF1.
User avatar
giftheck
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2218
Joined: Mon Jan 19, 2009 5:58 pm
Projects :: Star Wars Battlefront Anniversary

Re: TUTORIAL - Adding custom audio to shipped game

Post by giftheck »

Those serve for mod maps for Battlefront II, not main play for Battlefront I.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: TUTORIAL - Adding custom audio to shipped game

Post by Maveritchell »

What? No, they don't. The tutorial for SWBF1 or SWBF2 is exactly the same. Point out what exactly would be different to me, and I'll be glad to say that I'm wrong.
User avatar
giftheck
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2218
Joined: Mon Jan 19, 2009 5:58 pm
Projects :: Star Wars Battlefront Anniversary

Re: TUTORIAL - Adding custom audio to shipped game

Post by giftheck »

:eek: I wasn't accusing you of anything.

One main difference appears to be the frequency of the sound you use. I use 44100hz wav files, you use 22050hz mono files (according to the tut) or was that a mistake? Also with .wav, you cannot define the bitrate. Another is minor, but I'm telling the lua to look in the shipped sound folder, and not the addon/modid/_lvl_pc/sound folder. Plus, you can't loop sounds.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: TUTORIAL - Adding custom audio to shipped game

Post by Maveritchell »

There is more than one sound format supported, that is just what's recommended. And you're still missing part of my post, where I reference you to Vyse's tutorial. I can tell that you haven't read it, because it was actually originally written for SWBF1. It's a good tutorial, and goes in-depth about how to do multiple different sound types (mine only picks up where Vyse's left off, about ambient sounds). Your tutorial is fine, I was just pointing out that the tutorials we already have go more in-depth:
http://www.gametoast.com/forums/viewtop ... =27&t=9541
User avatar
giftheck
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2218
Joined: Mon Jan 19, 2009 5:58 pm
Projects :: Star Wars Battlefront Anniversary

Re: TUTORIAL - Adding custom audio to shipped game

Post by giftheck »

Thanks, I'll give it a look. I didn't find that even through search so I posted it here.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: TUTORIAL - Adding custom audio to shipped game

Post by Maveritchell »

It's in the "Everything you need" thread under "Sound." Even though the thread is for SWBF2, it still points to tutorials for SWBF1, because the two games are so similar.
Post Reply