project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding > Modding Tutorials
15 Nov 2019, 00:00:00 (PRT)
Register Developer Blogs Project Reality Members List Search Today's Posts Mark Forums Read
Modding Tutorials Information and tutorials related to modding BF2.

Reply
 
Thread Tools Display Modes
Old 2019-05-23, 02:15   #1
[R-DEV]​Arab
PR:BF2 Developer
Supporting Member

Arab's Avatar
Post Mass-Converting sample rates

WIP Tutorial. This tutorial is beneficial for all modders out there that have love for this ancient engine.

So after hours and hours of mind-numbing research, I found out it's possible to mass convert sample rates from one to another (while maintaining sound region markers) but it has some steps depending on what sample rate you want to convert from.

.ogg files has more steps due to some being serialized, some not being.
Serialization = System introduced by DICE with Battlefield 2 to allow .ogg sounds to be played in the network. It's needed for offline and online use.

Apparently DICE hard-codes serials in the .exe according to this: http://www.bfeditor.org/forums/index...ing-ogg-files/
But iirc someone in the past has developed a tool to create it apparently. BF2 Sound Tools has the files needed but it's picky on which number to use and is somewhat not noob friendly.

For example: The Comma Rose, music sounds for example need serialization of ogg files (Unless the format that Soundforge converts it isn't read properly by BF2).
Strangely, fire sounds don't require serialization though the only way to test if it works is by hosting a local dedicated server via lan or online if there's a server license and have someone join the server to see if the sounds work.

First thing you need to do is download and install Sound Forge 12 Pro Suite.
The advantages with Sound Forge 12 Pro Suite is that the markers are created by Soundforge, and converting them will preserve them unlike other converters.
Another advantage is that it leaves all sound settings alone including mono and stereo. This is important as if there's a mono sound in 3P converted to stereo, and is3DSound 1 is on, you will hear the sound played in all corners of the map in the same volume which will strain the engine.

In simple english: Engine idle sounds, automatic rifle firing sounds, Helicopter Rotor sounds, any sounds that loop with retain their sounds when their sample rates are being converted meaning you won't hear the sounds cut out when you're revving up that engine or firing that automatic weapon.

Converting from 44.1 kHz to 48 kHz using the setting below will have minimum quality changes but converting from under 44.1Hz (11.025, 22.05) to 48kHz with the same settings as 44.1 to 48 will result in quality loss and your sound will end up 'sounding' funny.

This can be fixed by simply using 'Resample 2' to upsample them to 48 kHz since using the same settings as 44.1kHz to 48.0kHz will negatively affect the sound quality.

So for viewing sampling rate, the best thing is to search for the .wav files in Explorer.exe, change to detailed mode (Context Menu, View -> Details), enable Bit Rate (Context Menu, Sort By -> More..., Tick 'Bit Rate' and press OK.

176 kbps = 11.025 kHz stereo
352 kbps = 22.05 kHz mono
705 kbps = 44.1 kHz mono
768 kbps = 48 kHz mono
1411 kbps = 44.1 kHz stereo
1536 kbps = 48 2 kHz channels

44.1kHz to 48.0kHz: 'Files to convert tab': Drag files with 705 kbps and 1411 kbps to Sound Forge Pro 12 Suite's Batch Converter window from Windows Explorer search
'In Process tab': Select 'Menu:', and choose 'Resample'. Click on 'Add Effect'. In 'Preset' select [Sys] Resample to 48,000 Hz with anti-alias filter and select 'Set the sample rate only (do not resample)'. Press OK.
'Save tab': Select 'Add Save Options', then select 'Same as Source' for all three options. Press OK.

Finally, select 'Run Job' and wait.

A good alternative to MediaInfo for viewing sampling rate is Wave Agent Beta which can view all the sampling rates in an easy column just to confirm the sampling rate.

For individual files, can right-click and go to Properties but MediaInfo obviously displays channels, bit depth, format (PCM Little / Signed) etc.

Now a question: Is there any way to batch add generated serial numbers to .ogg files?

Converting .ogg sample rates deletes the serial numbers which results in sounds not working in offline and online mode. An example is the Comma Rose voice sounds.


Also displaying all .ogg sample rates using the same method as above doesn't work in explorer.
One solution is mass converting them to .wav using Sound Forge without resampling and then use the above method to resample each sounds.
I know dragging the files to oggenc.exe encodes them to .ogg files but I would need to do around 500 per sound otherwise it won't work if it's a huge amount.
Also I hope there's a way to integrate serialization with oggenc.exe as part of the BF2 Sound Tools. Any advice?

Arab is offline
Last edited by Arab; 2019-05-23 at 04:20..
Reply With Quote
Reply


Tags
.ogg sample rate, .wav sample rate, batch convert, batch sample rate, batch sample rates, sample rate, sample rate conversion, sound modding
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 02:57.