Official BF Editor Forums

Bf4 Audio Decoder

Recommended Posts

Refer to the instructions here: http://www.bfeditor.org/forums/index.php?showtopic=15780

I still haven't found the time to dump everything, so I only used a few sample files. Let me know if the script fails somewhere.

Additionally, I've shaved off a few silent bytes for the xas compression. There are compressed blocks of 76 bytes which become 128 samples. However, most uncompressed audio is not a multiple of 128 samples. As a result, the last compressed block

contains some silence at the end. The ebx contains the info to cut off the silence though, which I have now taken into account.

Update 12.01.2014: Fixed EASpeex multichannel. Moved all decoding into the dlls to improve performance. The script really just handles the ebx files now while the dlls handle the decoding. Grab it here: https://www.dropbox.com/s/ox6clmozrzzvr5e/fb3decoder.zip

Edited by Frankelstner
Share on other sites

You're an angel!

Edited by -=anders=-
Share on other sites

Yeah, the sounds are cutoffed in the end...

Edited by -=anders=-
Share on other sites

While converting sounds from the sp_levels I keep getting the follow error:

Sound/Levels/SP_Airfield/Animation/SP_Airfield_s19_SFX_wave

Traceback (most recent call last):
File "C:\Users\Durandal-217\Desktop\fb2audio\fb3decoder.py", line 707, in <module>
decodeAudio()
File "C:\Users\Durandal-217\Desktop\fb2audio\fb3decoder.py", line 165, in decodeAudio
dbx.decode()
File "C:\Users\Durandal-217\Desktop\fb2audio\fb3decoder.py", line 580, in decode
numChannels=channelDict[channelRaw]
KeyError: '\x10'
>>> 

I just remove the ebx giving me the error and keep going.

Edited by Durandal-217
Share on other sites

While converting sounds from the sp_levels I keep getting the follow error:

...

I just remove the ebx giving me the error and keep going.

Thanks. I currently use channelDict={"\x00":1,"\x04":2,"\x0c":4,"\x14":6,"\x1c":8,"\x05":2,"\x01":1}

So \x10 is right between "\x0c":4 and "\x14":6 which suggests that there are 5 channels in that case. Odd, though I'll take a look at it when I'm done with my LZ77 decompression dll.

Share on other sites

Yeah I get this aswell...

Traceback (most recent call last):
File "H:\Ljudeffekter\BF3 audio\bf4 decoder\fb2decoder.py", line 707, in <module>
decodeAudio()
File "H:\Ljudeffekter\BF3 audio\bf4 decoder\fb2decoder.py", line 165, in decodeAudio
dbx.decode()
File "H:\Ljudeffekter\BF3 audio\bf4 decoder\fb2decoder.py", line 580, in decode
numChannels=channelDict[channelRaw]
KeyError: '\x10'
>>> 

Share on other sites

I can also back up that the audio in the VO gets cut off. An example is "I need you to attack this objective" ends up playing as "I need you to att-" so far none of the sound effects have this problem, plus a lot of dialog comes up as:

Unknown audio segment (type 19):d596dd9a65532ed6ca2bcccdbacf65122 Sound/VO/EN/MP/PA/vo_en_mp_pa_welcome

So none of the commander, or game mode VO converts. Hope this helps.

Edit: certain categories of sound effects suffer the cut off problem as well.

Edited by Durandal-217
Share on other sites

Yeah, the other soundeffects has this problem. Ive compared with the beta files... And as I said... like 70-80% of the sounds are missing.

Share on other sites

I can also back up that the audio in the VO gets cut off. An example is "I need you to attack this objective" ends up playing as "I need you to att-" so far none of the sound effects have this problem, plus a lot of dialog comes up as:

Unknown audio segment (type 19):d596dd9a65532ed6ca2bcccdbacf65122 Sound/VO/EN/MP/PA/vo_en_mp_pa_welcome

So none of the commander, or game mode VO converts. Hope this helps.

Oh well. Removing the audio cutoff is simple enough by removing just a single line that I had added. I wonder what the issue with that is though, it seemed to work well with a small sample.

I'm almost done with improving the dumper script performance by creating a dll for the decompression. Will take a look at the audio then.

Share on other sites

Oh well. Removing the audio cutoff is simple enough by removing just a single line that I had added. I wonder what the issue with that is though, it seemed to work well with a small sample.

I'm almost done with improving the dumper script performance by creating a dll for the decompression. Will take a look at the audio then.

Ill wait for you to update the script, looking at the script I don't even know which line it is anyway.

Share on other sites

I've removed the cutoff again and enabled an arbitrary channel number. Can't make any promises on type 19 as it seems like a different codec altogether.

Share on other sites

Thanks man it's better now. No more cutoff ( on old unpatched beta files, at least )

Edited by Vosvoy
Share on other sites

I'm rather confused right now. I've commented out the line about cutoff, which says

f2.truncate(int(round(Segment.SegmentLength*samplingRate*numChannels*2))+80) #+80 due to the header, *4 because each sample is a float

Now the odd part is that I multiplied by 2 instead of 4 for some reason despite the comment on the right. I don't recall if it was like this in the previous script too. Either way, I haven't heard any cutoff myself so I don't know which files might suffer from that. If anyone of you have had trouble with such files, you could change the factor to 4 and uncomment the line and see if the issues remain. Or if someone has the previous version, I'd be interested what the factor was there.

Share on other sites

if someone has the previous version, I'd be interested what the factor was there.

On the actual BF4 or the old?

Edited by Vosvoy
Share on other sites

I got this at the end:

Sound/VO/SP/SCENES/vo_en_sp_mocap_suez_s29_p2

Traceback (most recent call last):
File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 597, in <module>
decodeAudio()
File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 72, in decodeAudio
dbx.decode()
File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 452, in decode
raise Exception("Wrong XAS magic.")
Exception: Wrong XAS magic.
>>> 

I hope you'll be able to work out that type 19 error though when you have the time, I'm really interested in the commander dialog.

Edited by Durandal-217
Share on other sites

I got this at the end:

Sound/VO/SP/SCENES/vo_en_sp_mocap_suez_s29_p2

Traceback (most recent call last):
File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 597, in <module>
decodeAudio()
File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 72, in decodeAudio
dbx.decode()
File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 452, in decode
raise Exception("Wrong XAS magic.")
Exception: Wrong XAS magic.
>>> 

Thanks. I've changed the script to just skip the file when it does not know the magic. Will investigate later.

Share on other sites

Hi Frank,

When trying to run the fb2decoder, the script gives me: "EALayer3 tool detected." and does nothing after that. Did I miss a step? Just using the dumped ebx files, haven't modified them in any way. Just trying to get some of the music from the Suez mission out of the game :/

Share on other sites

The script parses all ebx files and checks if the primary instance is of type SoundWaveAsset. If it's not, then it continues with the next file. When you say it does nothing, do you mean it stops immediately or is it parsing the files (check the CPU load)? In the first case, you have probably not typed in the correct ebx path; in the latter case you will just need to wait longer.

Share on other sites

Frank, it's definately just stopping. No CPU load.

>>>
EALayer3 tool detected.
>>> 

Here are my paths, verified all are correct:

ebxFolder=   r"E:\hexing\bf4 dump\bundles\ebx\sound" #audio is found only in "Sound" (but only in bf3/bf4)
chunkFolder= r"E:\hexing\bf4 dump\chunks"
chunkFolder2=r"E:\hexing\bf4 dump\bundles\chunks" #if the chunk is not found in the first folder, use this one
outputFolder=r"E:\hexing\bf4 decoded"
ealayer3Path=r"E:\hexing\ealayer3.exe" #https://bitbucket.org/Zenchreal/ealayer3/downloads

I've experimented with a variety of different options, including just pointing it to the folder for the music I want to extract (music/warsaw/SP_Suez), as well as not using ealayer3, but the script still finishes without any decoded files.

Edited by dashner
Share on other sites

I can only guess at this point.

1) In case you haven't done so, you need to run the dumper script twice, first with the patched files, then with the unpatched files.

3) Use this function instead for some cheap debugging:

def decodeAudio():
for dir0, dirs, ff in os.walk(ebxFolder):
for fname in ff:
print fname
if fname[-4:]!=".ebx": continue
f=open(lp(dir0+"\\"+fname),"rb")
relPath=(dir0+"\\"+fname)[len(ebxFolder):-4]
if relPath[0]=="\\": relPath=relPath[1:]
print 1
try:
dbx=Dbx(f,relPath)
f.close()
except ValueError as msg:
print 2
f.close()
if str(msg).startswith("The file is not ebx: "):
continue
else: asdf
print 3
dbx.decode()

Share on other sites

Tried the function, at least got something in the script this time pointing at the SP_Suez folder but still no decoded files:

>>>
EALayer3 tool detected.
sp_suez_music_01_jinjie_moment_2ch_01.ebx
1
2
sp_suez_music_01_jinjie_moment_2ch_01_wave.ebx
1
2
sp_suez_music_01_jinjie_moment_2ch_02.ebx
1
2
sp_suez_music_01_jinjie_moment_2ch_02_wave.ebx
1
2
sp_suez_music_01_jinjie_moment_breachoneshot_2ch_01.ebx
1
2
sp_suez_music_01_jinjie_moment_breachoneshot_2ch_01_wave.ebx
1
2
sp_suez_music_02_bftheme_sacrifce_2ch_01.ebx
1
2
sp_suez_music_02_bftheme_sacrifce_2ch_01_wave.ebx
1
2
sp_suez_music_03_bftheme_approach_4ch_01.ebx
1
2
sp_suez_music_03_bftheme_approach_4ch_01_wave.ebx
1
2
sp_suez_music_04_bftheme_last_call_2ch_01.ebx
1
2
sp_suez_music_04_bftheme_last_call_2ch_01_wave.ebx
1
2
sp_suez_music_05_intothesunlanding_01.ebx
1
2
sp_suez_music_05_intothesunlanding_01_wave.ebx
1
2
sp_suez_music_06_stromlooparship_01.ebx
1
2
sp_suez_music_06_stromlooparship_01_wav.ebx
1
2
sp_suez_music_06_stromlooparship_02.ebx
1
2

Edited by dashner
Share on other sites

Well there you have it. The files do not start with CED1B20F and are thus not recognized as ebx. There's a chance that the previous pure Python dumper did not decompress all files properly, so you could dump the files again with the dll (which is much faster anyway). Other than that, upload an ebx file so I can take a look.

Share on other sites

I'm getting the same response for all the EBX files in the sound folder so I'm guessing I did do something wrong when I dumped it. Uploaded the EBXs just so you can take a second look at them if you'd like.

When you say dump with DLL, what do you mean by that? I can't seem to find a reference in your instructions for the sbtoc dumper.

The Suez EBX files: http://www.mediafire.com/?u5udy2od5a5368n

By the way, sorry for being a hassle. I just really want to get my hands on "A Theme for Kjell" from the soundtrack and I'm not patient enough to wait for the OST

Edited by dashner
Share on other sites

http://www.bfeditor.org/forums/index.php?showtopic=15844&st=0

Refer to http://www.bfeditor.org/forums/index.php?showtopic=15731&st=0 for instructions and to grab the Bundle.py file (it remains unchanged and is not given here). The script requires a dll to decompress the files: http://www.gamefront.com/files/23836405/LZ77.zip

The ebx files you have are compressed. I assume you have used the bf3 dumper on the unpatched files. That doesn't cut it. DICE changed the compression from zlib (not used for ebx files however which were uncompressed) to their own LZ77 variant which is applied to every single file.

Edited by Frankelstner
Share on other sites

I completely missed that, my apologies. going to redo the process now.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
×
• Create New...