[CSM] Audio files, file format problem, and tools to fix it..

Lots of cool and useful tips to mod either serverside or clientside

Audio files, file format problem, and tools to fix it..

Postby duffman » Thu Apr 17, 2014 8:45 am


Battlefield uses specific variation of wave file format. This can easily cause issues with creating audio samples with newer audio software, and samples are not played in the game as expected. To make sure your audio is in the correct format it is recommended to use Audacity 1.0.0 (see links to download below) as a final step before adding the wave file to the map. In other words: the sound sample you made in software x, saved in wave format should be opened in Audacity 1.0.0 and then saved again as the wave file you are gone use in map. (u can use Audacity 1.2.6 to convert between 11,22,44khz, and do your editing, then use Audacity 1.0.0 to make sure it is in the format Battlefield likes).


A lot of things in regards to Battlefield 1942 have had some old school thinking in regards to performance and techniques; if this is one of them or just a stuff up is hard to tell. But when the game loads wave files it expects the DATA entry in the wave file to follow right after the WAVE identifier. Getting a bit technical here.. but simply, the wave file or RIFF format (http://en.wikipedia.org/wiki/WAV) can have different chunks of information within.

Battlefield expects data to be the early on, and does not have the ability to process other chunks. So when it sees an unknown chunk it gives up and calls it an error. This is typical for newer audio editing software to add more chunks in there, while in the old days they kept it simple. Maybe they just made the decision that for performance reasons they removed all other irrelevant chunks.

Example 1: Bad WAVE file in battlefield (SOCRAWL2.wav)
Typical errors in the log file when running the debug exe:

Engine\SfxPc\Sample.cpp(110): . . . . Sound/44kHz/SOCRAWL2.wav Error: Non PCM format.
Engine\SfxPc\Sample.cpp(132): . . . . Sound/44kHz/SOCRAWL2.wav is corrupt. Error: Keyword 'data' not found.

Data in the audio file, notice the JUNK header before DATA header and the reason why Battlefield gets grumpy..

Offset(h) 00 04 08 0C 10 14 18 1C
00000000 52494646 D8780000 57415645 666D7420 12000000 01000100 44AC0000 88580100 RIFFØx..WAVEfmt ........D..ˆX..
00000020 02001000 00004A55 4E4BCA01 00000000 00000000 00000000 00000000 00000000 ......JUNKÊ.....................
00000040 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................
00000060 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................
000001E0 00000000 00000000 00000000 00000000 00000000 00000000 64617461 30760000 ........................data0v..
00000200 BC014802 9802AB02 FB029803 F803E003 E4037504 34058905 79054E05 02055F04 ¼.H.˜.".û.˜.ø.à.ä.u.4.‰.y.N..._.

Example 2: How battlefield likes it (SOCRAWL1.wav)
Notice how the DATA field comes right after WAVE keyword.

Offset(h) 00 04 08 0C 10 14 18 1C
00000000 52494646 92730000 57415645 666D7420 10000000 01000100 44AC0000 88580100 RIFF's..WAVEfmt ........D..ˆX..
00000020 02001000 64617461 BE720000 9900D900 2501FB00 7D007500 FD005401 39010F01 ....data¾r..™.Ù.%.û.}.u.ý.T.9...
00000040 A80097FF 99FED4FE 9EFF8EFF 64FFC200 6C029501 09FF6AFE 06006E00 0DFF6FFF ¨.-ÿ™þÔþžÿŽÿdÿÂ.l.o..ÿjþ..n..ÿoÿ
00000060 2E02D602 B1FF83FD 9FFF0B02 850000FE 56FFCC02 2C036E00 FDFE0000 9E00E7FF ..Ö.±ÿƒýŸÿ..…..þVÿÌ.,.n.ýþ..ž.çÿ
00000080 2000C801 2B020E00 1BFED6FE F0005701 83FFF9FD D3FEFB00 D701D300 0200C600 .È.+....þÖþð.W.ƒÿùýÓþû.×.Ó...Æ.


Download Audacity (free)
1.0.0 http://sourceforge.net/projects/audacit ... ity/1.0.0/
1.2.6 http://sourceforge.net/projects/audacit ... ity/1.2.6/

Best to download the zip files, and extract them manually.
Create a folder in "Program Files" called /Audacity100 and /Audacity126, dump the contents of each zip file in respective folders. And drag a shortcut of the exe (hold ALT while dragging) to your desktop.

Hex editor (free) (not needed, but a good tool for the curious)
Posts: 40
Joined: Tue Apr 15, 2014 8:02 am

Re: Audio files, file format problem, and tools to fix it..

Postby Swaffy » Wed May 14, 2014 8:15 pm

I have been using GoldWave and saving my files as WAV using the setting "PCM Signed 16 bit, " then with Stereo or Mono depending on which file I want to make.

Is this correct? Because the Battlefield 1942 debugger seems to be giving me errors with my audio files. I'm going to try what you said and save them again using Audacity.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Audio files, file format problem, and tools to fix it..

Postby duffman » Wed Jun 04, 2014 4:58 am

I think from memory there was two types of audio file errors I noticed in the debugger log. I only looked at solving one of them which is the format of the data file I described above. The problem is that you can't tell what tags the audio editing software adds to the file format without viewing the file in a hex editor. Newer software versions might use new tags, and the format standard might have created new tags that the software starts using.

That was why I added links to the older versions of Audacity, because I know that they will re-format the data file into older version that the game engine will run without dramas. Sorry about the late reply, and you probably have solved this one already!? (the issue you have might be a different one)

(would be handy with a tool to strip rubbish-tags of these audio files so that it does not matter what application and versions is used to create audio files. Maybe a command line tool that could be run as part of a "build" script. Have been very busy lately with other things, but I am gone add this to my backlog of projects.)
Posts: 40
Joined: Tue Apr 15, 2014 8:02 am

Return to General Modding Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests