The Ultimate Sound Modding Tutorial [WIP]

Started by Phobos, December 19, 2012, 09:31:55 PM

Previous topic - Next topic
December 19, 2012, 09:31:55 PM Last Edit: December 20, 2012, 04:40:48 AM by Phobos
Approximate Tutorial Completion: 33%

I. Sound Modding Resources
II. Sound Munging
III. Building custom music and sound region streams
IV. Building custom voiceover streams
V. Building custom in game sound effects
VI. FAQ


I. Sound Modding Resources
Sound.lvl modding can be difficult in SWBF1, mostly because of the lack of documentation and resources available to modders. Fear not however, this tutorial is specifically designed to make sound munging as easy for you to understand as possible. I will try to cover as much ground as I can, however I am still learning more about sound modding, and will continue to add to this thread as I figure out more about it.

There are a few resources you will want to have to begin. First is the sound config assets included in BFBuilder. They contain most of the reqs, snd, stm, and other files you will need to learn how sound configuration files are structured. There is also a premunged soundconfig available on fred's website, but it's not very useful. Note that do to copyright issues, none of the stock WAV files are available in BFBuilder, although some modders have been able to extract or re-record them through other methods.

You will also need an audio editor to convert and reformat audio files. I use audacity which is freeware and can be downloaded here:
http://audacity.sourceforge.net/download/
Audacity may also require you to download lame_enc.dll in order to import mp3 files you can find this on google.

I think these are updated batch files for BF2 sound munging, not sure if they work in BF1 or not.
https://sites.google.com/site/swbf2modtoolsdocumentation/ZeroFiledump/soundmungefixes.zip

Psych0fred wrote five different sound text tutorials which I suggest you start reading after this. I will try to consolidate and explain the information contained in them for this tutorial.

Here are some links worth reading.
Quote
Fred's 5 sound tutorials:
http://secretsociety.com/forum/downloads/Sound%20Engine%20Guide.txt
http://secretsociety.com/forum/downloads/SoundDoc%20-%20Music.txt
http://secretsociety.com/forum/downloads/SoundDoc-YA.txt
http://secretsociety.com/forum/downloads/soundhooks.txt
http://secretsociety.com/forum/downloads/soundreadme.txt

Maveritchell's ambient music tutorial
http://www.gametoast.com/forums/viewtopic.php?f=27&t=12236

Stock BF1 sound extracting discussion
http://gametoast.com/forums/viewtopic.php?f=64&t=28297

GGCTuk's custom audio tutorial
http://www.gametoast.com/forums/viewtopic.php?f=1&t=17164

Marth8880's sound research FAQ
http://www.gametoast.com/forums/viewtopic.php?f=27&t=28101

I am also working on three different sound.lvl builders currently. They will be available for download when the LVL Toolbox V5 is released. One will be for music and region soundstreams, another for voiceovers, and another for in game sound effects. I am about 25% finished with them atm.

II. Sound Munging

*Currently I can only get sound to munge on 32-bit PC. I am working on a solution for 64-bit sound munging and will post any updates here. See this thread for more info.

When you munge a sound LVL, it takes the configuration files and converts them to a different format, listed below. It also combines the WAV files with the STM (or ST4) to create the STR file. 

munged => source
lvl => req file names
bnk => sfx, ffx, and asfx files
config => snd, mus and tsr files
str => stm and st4 files


All of the above listed configuration source files are edited using notepad so I recommend setting file association to open them.

REQ/SND
All sound.lvls need at least one req and one SND file to define the sound properties. The REQ(s) basically specifies which files are going to be munged into the LVL (except the WAVs which the STM specifies). The SND is used for every type of sound: streams, VOs, and effects. SND files are by far the most advanced, complex sound files you will mod, and I recommend reading psych0fred's tutorials for more in-depth information about SND configuration, as most of the settings I do not fully understand yet.

FFX/SFX/ASFX
SFX and ASFX are used for in-game ODF sound effects, which are stored in a "bnk" file that can be called upon directly or munged into a sound LVL. FFX is used for sounds called by FX files stored in the common.lvl. Their structure is much like the STM files as their main purpose is to index WAV files (and assign ID tags to them if you choose to here).

MUS/TSR
The MUS file is used for in-game streaming music/ambience for the entire map, and you can specify different streams for each faction in the mission LUA if you want. TSR files are used for sound regions - as defined in zeroeditor by sound spheres - in specific worlds, and are streamed globally for all factions (example cantina bar music).

STM/ST4
STM files are used to index the majority of streams in game, ST4 is used rarely for defining quadruple channel output bus audio files. The STM file specifies which WAV files to munge (including their sub-directory pathing, which by default is 'streams' or 'effects'), and can also apply the ID tag to be called on via the LUA (the SND can also apply this using "segments", more on that later).

WAV
WAV files must also be formatted a certain way depending on what you are going to use them for. The sample rate is always 16bit no matter what, the other values are noted below:

VO Wav Format - 22khz, 16 bit, mono
Music Wav Format 44khz or 48khz, 16 bit, stereo
Sound Effects Wav Format - 44khz, 16 bit, mono


I have not tested compressed WAV files yet but I will soon. Also I have discovered if you call upon a WAV file not present in the streams or effects folder through the STM, the sound.lvl will not munge

Quote from: psych0fred
SND = Sound config file define sound properties referenced by luas, ODFs and particle effects
FFX = Foley effects config file used for connecting events in code to sound properties
SFX = Sound effects files list the paths to sound samples which are munged into a given sound bank
ASFX = Additional sound effects files, same as sfx but added for mods to supplement existing banks on PC*
MUS = Music config files define additional properties for triggering music sound streams
TSR = Sound trigger region config files define properties for triggering sounds in sound regions
STM = Stream files list the paths to stream files
ST4 = Stream files list paths to pairs of quadraphphonic stream files
WAV = Binary wav files are differing formats for VO streams, Music streams, and sound effects


III. Building custom music and sound region streams:
Under construction should have this section updated soon.

IV. Building custom voiceover streams:
Under construction
note: shell_interface.lua calls on the LVL then the STR.

V. Building custom in game sound effects:
Under construction

VI. FAQ

1. Can mp3s be used?
- Not directly, but you can easily convert mp3s or any other audio format to WAV files. If you can, try to use the highest quality mp3 you have, for example CBR320 or VBR0 instead of CBR128, or it will create an inflated bitrate that sounds inferior to lossless sound. FLAC works great because it is compressed lossless format. The sound munger applies some compression but I'm not sure how it affects the bitrate once munged.

2. How do I add a pre-compiled music sound.lvl to my mod map?
- You have to edit the mission LUA to call on it. There are 3 parts of code you must add. First is the ReadDataFile, then OpenAudioStream, and then the SetAmbientMusic, which calls on the ID tags of the wav files specified by either the SND or STR. If you don't know the names of the stream IDs you can look in the munged mission.lvl for the mod they are used in.

Example:

To be continued



I do not mean to poke or prod in any way what so ever, but is this still being worked on at all?
- I seem to be figuring it out by myself, but it would definitely help if this was complete  :shrug:

Quote from: -RepublicCommando- on September 20, 2013, 08:29:09 PM
I do not mean to poke or prod in any way what so ever, but is this still being worked on at all?
- I seem to be figuring it out by myself, but it would definitely help if this was complete  :shrug:
I am working on other modding projects atm, but if you need help with anything in particular i might be able to expand the tutorial a bit.
- When trying to add custom weapon sounds for snake's mod I ran into a bug that wouldn't munge the sound lvl.

http://www.native-instruments.com/en/products/komplete/bundles/komplete-players/

free synthesizer program, can be used for music or sound effects. I think you will need a DAW for running reaktor through guitar rig 5, for a wider range of sounds.  I have the full version which I use for music. My brother is making a game and he needed a sound for one of his weapons, so I used Reaktor 5 and made a sound for his laser gun thing. 
I'm pretty sure all of these free VST's in the link bellow need a DAW to run (synthesizers and effects)
http://www.musicradar.com/us/tuition/tech/the-27-best-free-vst-plug-ins-in-the-world-today-277953


September 21, 2013, 01:38:12 AM #5 Last Edit: September 21, 2013, 01:41:13 AM by tirpider
Doesn't Audacity (free) have a built in VST host?

-edit...
nevermind.. I read "Native Instruments" and $ started going through my head. Didn't read the free part.

Very cool find. I may tinker with it if I ever get my new PC.

Personally for me i dont need this tut cuz i found all this things myself and know how to add almost every type of sound but i have only one question.Can i have guns sounds that are stereo?Because stereo type i think is better than mono.

Quote from: Ginev on September 21, 2013, 02:10:24 AM
Personally for me i dont need this tut cuz i found all this things myself and know how to add almost every type of sound but i have only one question.Can i have guns sounds that are stereo?Because stereo type i think is better than mono.
good for you but some modders do need tutorials to figure things out

September 21, 2013, 04:05:58 AM #8 Last Edit: September 21, 2013, 04:07:45 AM by Ginev
Yes yes.Actually i will read everything just in case i don't know something :D
About the question i post i hope someone have answer.Ohh and one more think.The only sounds that don't know how to add are footsteps.

i cant get weapon sound effects to munge in stereo either

September 21, 2013, 05:54:06 AM #10 Last Edit: September 21, 2013, 06:00:56 AM by -RepublicCommando-
Quote from: Phobos on September 21, 2013, 04:36:31 AM
i cant get weapon sound effects to munge in stereo either
Seeing as the weapon and misc other effects always stream from one specific point (an objects x, y and z) it would be strange to have a left and right effect variable setup.. How on earth would that be configured under the hood? :P I know from other small engines, that stereo doesn't really add much effect when using something thats practically mono in the first place, its more just the quality of your sound that matters.
Its kind of annoying when you accidently convert it a tad bit wrong, and never end up knowing what is the problem is.
----
But enough of my rambling, I have a program I always use and it's freeware as well:
http://www.nch.com.au/wavepad/index.html
As fate would have it, I cannot find a version on their site that has all the features it used to..(without paying for it, atleast)
I still have a setup.exe for it, and a stand-alone .exe that runs just fine under Vista and my Windows7 PC.
I might consider uploading it, if anyone cares. Its a brilliant program.

Quote from: -RepublicCommando- on September 21, 2013, 05:54:06 AM

----
But enough of my rambling, I have a program I always use and it's freeware as well:
http://www.nch.com.au/wavepad/index.html
As fate would have it, I cannot find a version on their site that has all the features it used to..(without paying for it, atleast)
I still have a setup.exe for it, and a stand-alone .exe that runs just fine under Vista and my Windows7 PC.
I might consider uploading it, if anyone cares. Its a brilliant program.

Try here:
http://www.oldversion.com/windows/wavepad/

Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

Looks like Audacity has VST host for effects but not instruments.

Quote from: Buckler on September 21, 2013, 07:15:59 AM
Try here:
http://www.oldversion.com/windows/wavepad/
Led you're a wonder!
I just happened to accidentally (well, not really but..) delete all the contents of my flash drive, which included WavePad. And yes yes, I know. "Google is your best friend." :)

Quote from: vansting on September 21, 2013, 11:12:18 AM
Looks like Audacity has VST host for effects but not instruments.
It's a pain trying to use VST in editors like a'udacity and goldwave anyway. They're made for DAWs