Jump to content
Official BF Editor Forums
Frankelstner

Bf4 Audio Decoder

Recommended Posts

It seems to be working with virtually all of the SFX files now, getting a lot of decoded files, but still the same thing with the music ebx files.

Fairly sure I followed the process correctly, maybe the music files themselves are different?

Edited by dashner

Share this post


Link to post
Share on other sites

Something seems to be missing.

I just did a complete dump of BF4 using the latest script code with the dll from the other thread.

Resulted in a 22,8GB large dump folder.

No errors, all seems fine.

Then I ran the latest Audio Decoder. Again all went smooth, no errors.

But it resulted in a folder that is 966MB large.

Someone who extracted the sounds of the alpha, resulted in 5GB of wav files.

i.e. the following was present in the extracted alpha files

Sound/VO/Common/CH/Comrose/Trose/vo_ch_mp_trose_morale_boost

when I look at the dump, this file exists:

H:\bf4 dump\bundles\ebx\sound/vo/common/ch/comrose/trose/vo_ch_mp_trose_morale_boost.ebx

but there is no "Sound/VO/Common/CH/" in the audio decoder output dir.

Neither do I have the "/Warsaw/" folder inside "Sound/Music/" just like dashner.

I am trying to run the decoder a 2nd time now like he did.

here is the shell output from the dump and the decoder: https://www.dropbox.com/s/hzzhscc6popvptk/shell%20results.zip

Any idea what is going wrong on my end?

-------edit1-------

I think I know now, I did not run the dumper a 2nd time with the "tocRoot" changed to the "Data\Win32"

doing that now

-------edit2-------

I ran the dumper first with "tocRoot=bf4Directory+"\\"+r"Update\Patch\Data\Win32"

Then a 2nd time with "tocRoot=bf4Directory+"\\"+r"Data\Win32"

because thats how I understood

##Adjust paths here. The script doesn't overwrite existing files so set tocRoot to the patched files first,

##then run the script again with the unpatched ones to get all files at their most recent version.

If I run the audio decoder now, then it will not decode/place a single file into the outputfolder anymore. :S

-------edit3-------

deleted everything, restarted from scracth, and now the dump folder is nearly 2 times as large as before.

running the audio decoder now. =)

-------edit4-------

now it works!

this time i only ran the dumper with tocRoot=bf4Directory+"\\"+r"Data\Win32"

Edited by infinityloop

Share this post


Link to post
Share on other sites

I'm not able to download the fb2audio.zip from the gamefront, could somebody upload it to mediafire or something similar? I just want to get my hands on the loading screen themes...

Share this post


Link to post
Share on other sites

could you tell me what I did wrong because I get this error:

Speex segment not converted as dll is missing: dcb4720651bc2297a6172e43339f6298 Sound/VO/Common/CH/Autotriggers/Inform/Radio/vo_ch_mp_comment_driver_bail_r

Traceback (most recent call last):
 File "C:\Users\D\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 609, in <module>
   decodeAudio()
 File "C:\Users\D\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 78, in decodeAudio
   dbx.decode()
 File "C:\Users\D\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 479, in decode
   speex.decode(currentChunkName, target, Segment.SamplesOffset)
NameError: global name 'speex' is not defined
>>>

I put the speex dll in the same folder as the script. By the way out of curiosity does the decoder script work on the dlc that is out? From what I've tried it doesn't look like it does I know you've been busy but do you have any plans on updating that?

Edited by Durandal-217

Share this post


Link to post
Share on other sites

It works fine when placed in the Python27 folder. Anyway, you must have 32bit Python to use the dll. Though wait a sec, that is required for xas too. I don't really have any ideas right now.

I haven't tried it myself, but I suppose the decoder should work with the DLC too. Is there any error message in particular or does it just not do anything?

Edited by Frankelstner

Share this post


Link to post
Share on other sites
It doesn't do anything.

I think we should elaborate a bit to prevent misunderstanding.

So you mean to say that you have used the bf4 audio decoder (the previous version without speex support) to decode the xpack audio? I see a couple of issues. The dumper script does not handle noncas sbtoc yet so maybe the chunks are hiding there. Also, how did you define the chunk folders? Did you merge the DLC files with the other files (which is what I recommend)? In that case however, have you used some tool to determine the difference in output before and after adding the DLC files?

About speex, try to replace the try/except at the top with a simple statement, i.e. substitute

try:
   speex = cdll.LoadLibrary("easpeex")
   isSpeex=True
except:
   isSpeex=False

with

speex = cdll.LoadLibrary("easpeex")

The error message should be a bit more descriptive as to what's going on.

Share this post


Link to post
Share on other sites

I think we should elaborate a bit to prevent misunderstanding.

So you mean to say that you have used the bf4 audio decoder (the previous version without speex support) to decode the xpack audio? I see a couple of issues. The dumper script does not handle noncas sbtoc yet so maybe the chunks are hiding there. Also, how did you define the chunk folders? Did you merge the DLC files with the other files (which is what I recommend)? In that case however, have you used some tool to determine the difference in output before and after adding the DLC files?

About speex, try to replace the try/except at the top with a simple statement, i.e. substitute

try:
   speex = cdll.LoadLibrary("easpeex")
   isSpeex=True
except:
   isSpeex=False

with

speex = cdll.LoadLibrary("easpeex")

The error message should be a bit more descriptive as to what's going on.

I'm sorry I should have elaborated earlier, my mistake. What I meant was the dumper script does not extract noncas sbtoc toc properly. For example I was trying to get the L85A2 reload sound but after running the script I cannot find any folders with the DLC filename (XP0-XP1 Xpack ect.) I ran The dumper script as you instructed, first I dumped the non patched files then ran it again to dump patched files. I don't know which tool to use in order to determine if the files are different or even how to tell if they are.

As for Speex I did as you said, however it didn't work, this is what I did.

##############################################################
##############################################################
speex = cdll.LoadLibrary("easpeex")

def unpackBE(typ,data): return unpack(">"+typ,data)

and got the following.

Traceback (most recent call last):
 File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 34, in <module>
   speex = cdll.LoadLibrary("easpeex")
 File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
   return self._dlltype(name)
 File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
   self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
>>> 

I probably did it wrong, oh and I also placed the Speex DLL in the python folder during all of this and tested both with the default XAS script and the change you wanted me to make. Nothing worked.

Share this post


Link to post
Share on other sites

I'm sorry I should have elaborated earlier, my mistake. What I meant was the dumper script does not extract noncas sbtoc toc properly. For example I was trying to get the L85A2 reload sound but after running the script I cannot find any folders with the DLC filename (XP0-XP1 Xpack ect.) I ran The dumper script as you instructed, first I dumped the non patched files then ran it again to dump patched files. I don't know which tool to use in order to determine if the files are different or even how to tell if they are.

Aha. The dumper doesn't support the xpacks at the moment as they are noncas (and of course different from the noncas from bf3). I've downloaded the xpack files just yesterday and managed to dump the unpatched noncas, plus I'm about 50% done with the patched noncas. Thus it shouldn't take too long until I finish this. Will post the script when I'm done.

As for Speex I did as you said, however it didn't work, this is what I did.

...

and got the following.

Traceback (most recent call last):
 File "C:\Users\Durandal-217\Desktop\fb3extractor\Xas decoder\fb3audio.py", line 34, in <module>
   speex = cdll.LoadLibrary("easpeex")
 File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
   return self._dlltype(name)
 File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
   self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
>>> 

I probably did it wrong, oh and I also placed the Speex DLL in the python folder during all of this and tested both with the default XAS script and the change you wanted me to make. Nothing worked.

I've changed some settings when compiling now. Does this dll fix it? http://www.gamefront.com/files/23943162/easpeex.zip

Share this post


Link to post
Share on other sites

I've updated the script to handle those 6 EASpeex stereo files correctly. Additionally I've cut down the EASpeex volume in half to get rid of clipping. The codec gives me back floats in a range of about +-50000.0 so I just divide by 65536 (instead of 32768) to get decent samples.

Share this post


Link to post
Share on other sites

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 27.12.2013: Added EASpeex support.

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

Another GOOD work.

Nice one

thank you and good luck

Share this post


Link to post
Share on other sites

I've updated the script to handle those 6 EASpeex stereo files correctly. Additionally I've cut down the EASpeex volume in half to get rid of clipping. The codec gives me back floats in a range of about +-50000.0 so I just divide by 65536 (instead of 32768) to get decent samples.

Working like a charm! =)

Share this post


Link to post
Share on other sites

Hi!! Sorry to go a little off-topic here but can anyone reupload this file/s for me? http://www.gamefront.com/files/23423833/fb2audio.zip I tried to download it using a proxy(f*ck you gamefront) but it looks like it was already deleted Dx

I'm really interested into ripping BBC2's sounds and those seem to be the "core" files to the whole thing, so yeah xD

Thanks in advance!!

Edited by Guerriel

Share this post


Link to post
Share on other sites

 

What are you talking of? that website link works fine for the download, just tested.

 

Ah WTF... It does work LOL, no idea why I couldn't download it before...

Well... thanks for the heads up!! xD

Share this post


Link to post
Share on other sites

As for BattleField Hardline, this Script works up to the VO folder which is very close to the end, it misses all Weapon sounds, it throws this error

Traceback (most recent call last):

File "S:\BFH\Audio Dumper\fb3decoder.py", line 564, in

main()

File "S:\BFH\Audio Dumper\fb3decoder.py", line 561, in main

dbx.decode()

File "S:\BFH\Audio Dumper\fb3decoder.py", line 514, in decode

decodeXas(currentChunkName, target, Segment.SamplesOffset)

File "S:\BFH\Audio Dumper\fb3decoder.py", line 67, in decodeXas

xas.decode(chunkPath, target, samplesOffset)

WindowsError: [Error -529697949] Windows Error 0xE06D7363

Frank any Ideas on how to get a full dump

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×