Metal Gear Solid IV Audio/MTAF by Callicojacks at 11:15 AM EDT on May 2, 2016
I've been doing research, and I've gotten as far at demuxing DAT files and getting MTAF files from them.

But how do I turn those into Audio files that I can listen to?

I found this: https://github.com/GHzGangster?tab=activity

and

this https://app.box.com/s/9en2aqajomma0rthxzv79ge506u3gb31

but I have no clue how to use those. I would greatly appreciate some help.

edited 9:39 PM EDT May 2, 2016
by Moonboy65 at 1:42 PM EDT on May 2, 2016
nice thread title lol
by AnonRunzes at 5:20 PM EDT on May 2, 2016
@Moonboy65 - If you don't want to help, then don't go out on random threads saying "nice thread title lol", because you just look like you are trolling someone out of spite.
by hcs at 10:01 PM EDT on May 2, 2016
The AudioTool-decode.jar from that box.com link is a Java program, you'll need to get a Java runtime and run it like:

java -jar AudioTool-decode.jar blah.mta2

to decode a particular mta2 file. It seems to work on the .bgm files I've seen in the only rip I have on hand.
by Callicojacks at 11:29 AM EDT on May 4, 2016
Thanks! I'm not used to programs like that, but I'll give it a shot in a few. I'll comment on my success or failure.
by Callicojacks at 11:50 AM EDT on May 5, 2016
I'm supposed to run a cmd prompt, right?

DOing that and typing in the text gets me "unable to access jarfile AudioTool-decode.jar

EDIT!!!!

having gotten prompt to run out of the folder I have those programs in, it reads that it could not recreate the Java Virtual Machine and unrecognized option

edited 11:56 AM EDT May 5, 2016
by hcs at 12:03 AM EDT on May 6, 2016
I don't know what those errors mean.

Google leads to this for the first error: Fix "could not create the java virtual machine" issue
by Callicojacks at 10:49 PM EDT on May 10, 2016
Just tried it now, successfully.

I just want to say thank you so, so much, HCS. You are awesome!

I have a lot of decoding/demuxing/converting to do, but it'll be worth it.
by id-daemon at 11:21 AM EDT on May 17, 2016
Good to know that my research on this format was useful. That was really exciting to crack an unknown format without the code or any possibility to know the tables used. HCS must know what I mean ;)

Research thread:

forum.xentax.com........



edited 12:38 PM EDT May 17, 2016
by hcs at 1:28 PM EDT on May 17, 2016
Indeed it's very cool, I'd love to hear how you were able to do it.

I worked out most of MTAF without access to the code and I was able to approximate the table by minimizing the errors in the history samples; this involved a linear algebra solver with lapack and blas (here).

But eventually someone just sent me code containing the exact table, which retrospectively is pretty obvious in a memory dump. Are your tables exact, or a very good approximation?

edited 1:37 PM EDT May 17, 2016
by id-daemon at 6:59 AM EDT on May 21, 2016
Yeah, it was a cool story. Many rounds of precision increase (iterations), and finally I calculated the exact values.

First I found the interleave scheme. Initial samples, nibbles. I thought it was IMA like in MTAF, but it was not. After more analizing the nibbles, I understood it was XAS variant, but with bigger tables. Instead of just 4 predictor types and 13 shifts (from 0 to 12 bits), like in EA XAS, in has 8 types and 32 scale coefficients.

I had no idea of the table values. So first I tried decoding each block and see if it will correspond with the initial sample value of next block. I took very quiet first blocks, which had 0 shift/scale. Predictor 2 was most used, so I tried it first, then others. This way I found that actually first 5 types (predictors) were usual XAS types. 240/0, 460/-208, you know that. Other 3 predictors were probably invented specially for MTA2.

Then I had to do something with scale table. I made a very rough approximation of all 32 values, and that allowed me to decode the whole music track. It was heavily distorted, as you can imagine. I still have that sound saved for history :)

Then one by one I started to correct the table values. After many iterations I was able to increase precision of predictors and scale table in turns. It was slow, so I made a solver, just as you did. It allowed me to find exact predictors values. The deltas were so clear, that I have no doubt, they are correct.

The final step was to find exact values for scale table. Music track couldn't help me with that, because highest values were rarely used, and lowest values introduced too much of a range. So I had very good approximation in the middle of a table, and not-so-good at the ends.

Then, after making a visual graph from these values, I suddenly understood they were calculated by some simple and logical formula. After some time, I was able to guess that formula, and the result was a perfectly clear sound.


edited 7:03 AM EDT May 21, 2016
by AnonRunzes at 10:14 AM EDT on May 21, 2016
@id-daemon - That's cool to hear how you made decoding MGS4's audio format possible but why Java?
by id-daemon at 10:36 AM EDT on May 21, 2016
I was not making the tools. I researched the algorithm and tables. Tools were made by other people.

edited 10:36 AM EDT May 21, 2016
by AnonRunzes at 10:41 AM EDT on May 21, 2016
@id-daemon - I see. It still bugs me though, since there should be more similar tools beyond the .jar one.

edited 10:42 AM EDT May 21, 2016
by id-daemon at 11:29 AM EDT on May 21, 2016
well i could release my tool used for experiments as a normal .exe, but there are so many types of containers... movies, voices, sfx, they all use the same codec.
by hcs at 11:32 AM EDT on May 21, 2016
Thanks for the story!
by AnonRunzes at 11:37 AM EDT on May 21, 2016
@id-daemon - Well I don't see the reason why not...
by id-daemon at 11:56 AM EDT on May 21, 2016
Because I'd have to learn and support all these containers, or you'll have to extract streams from them yourself.
by AnonRunzes at 8:59 PM EDT on May 21, 2016
@id-daemon - That`s exactly what I`m lacking at.
Is there any way to extract these .dat files?
by id-daemon at 5:14 PM EDT on May 23, 2016
What are dat files? Can you give an example?
by AnonRunzes at 6:46 PM EDT on May 23, 2016
These dat files like bgm.dat, demo.dat and the like.
I might post these when I feel like it though.
by hcs at 6:21 PM EDT on May 24, 2016
Try demux_dat

demux_dat_be.exe may work on MGS4.

"demux_dat 0.2 extracts audio from the .DAT files in Metal Gear Solid 3. Included is demux_dat_be which should work on Metal Gear Solid 4, but it is not tested."

edited 6:31 PM EDT May 24, 2016
by AnonRunzes at 7:43 PM EDT on May 24, 2016
Well, with that said, it extracts .dat files that contain only audio, video and subtitle data. That means it's unstable of extracting .dat files that contain other types, right? Here's codec.dat for example.

edited 7:48 PM EDT May 24, 2016
by hcs at 11:07 PM EDT on May 24, 2016
It seems like codec.dat is just text, you can extract that with DATCodecTool. Here's an exe compiled with Mono.
by AnonRunzes at 11:25 PM EDT on May 24, 2016
Thanks for compiling it to me, hcs. If anything, can I ask you to compile the rest when I'm done organizing some stuff?
by hcs at 12:08 AM EDT on May 25, 2016
Here's all the executables for MGSDATool, untested.
by AnonRunzes at 8:48 AM EDT on May 25, 2016
Thanks. But what about these .dbm files that contain MTA2 data? Here's an sample.

EDIT: Huh. Just by executing the .jar file through a command-line program, I am rewarded by this error. Am I doing something wrong?

edited 9:40 AM EDT May 25, 2016
by secaproject at 12:56 PM EDT on May 25, 2016
Hi AnonRunzes, I'm a little lost, you need to extract mta2 files from dmb files? Or you are trying to convert dbm file directly?

edited 1:00 PM EDT May 25, 2016
by AnonRunzes at 4:33 PM EDT on May 25, 2016
@secaproject - You can only extract mta2 files from .dat archives. Might as well rename the .dbm file to .dat and see what happens.

EDIT: Nope, it doesn't work with .dbm files either even if you rename them.

edited 4:37 PM EDT May 25, 2016
by secaproject at 7:56 PM EDT on May 25, 2016
Negative, you can also extract MTA2 from dbm files. DBM files works in different way, so rename the file is not the solution. Extracting the mta2 within it's so simple, remove first 2080 bytes and then try to convert the "dbm" file.

edited 7:58 PM EDT May 25, 2016
by AnonRunzes at 8:43 PM EDT on May 25, 2016
Well I tried what you suggested and it worked fine except for these two files(I was rewarded with a "unknown block type 0 at 0" error). Here's a sample.
by secaproject at 8:45 PM EDT on May 25, 2016
In this both files must remove 32 bytes more.
by AnonRunzes at 9:06 PM EDT on May 25, 2016
^ Well, no need to do that because I was actually mistaken. demux_dat_be.exe can work with these just fine, since I didn't realize I already saved those files.

Thanks though.

edited 9:19 PM EDT May 25, 2016
by GHzGangster at 2:13 AM EDT on May 26, 2016
That Direct Buffer error means it ran out of memory. Right not the tool doesn't work for very large files, I think there are like 2 files it won't work on.

Right now, the whole tool is undergoing a rewrite to better support the BGM/DLBM formats, and is really focusing on importing/encoding audio. Speech and SFX support will come too, I just haven't looked at it lately.

DLBMs should work out of the box, though. You shouldn't need to dechunk them. You could try the older GUI version that I made a while ago, maybe it will make it simpler for you.
https://mega.nz/#!glQQ3ITC!9e7VV3cmupKbIY2_w3E9T4TlVls2wUR_KbdSJaoHjaI

The audio playback won't work unless the sample rate and channels are supported by your computer. 1/2 channel tracks usually work just fine, 4 channel I can't get playing on my computer right now. I'll be sure to mix the channels in my newer version. You can easily export them, however.

But yeah, if you need help with anything, I'll be keeping an eye on this thread. Didn't see it before.

edited 11:16 AM EDT May 26, 2016
by zubren at 4:04 AM EDT on May 31, 2016
Has anyone had any luck with using demux_dat_be.exe on MGS4's vox.dat?
I get the following output from vox.dat (US retail release, BLUS30109):
file 1 at 0x00000008 has audio (subtype 1)
file 2 at 0x00008808 has audio (subtype 1)
file 3 at 0x002d2808 has audio (subtype 1)
file 4 at 0x005b1808 has unknown 3 (subtype 5)
file 4 at 0x005b1818 has audio (subtype 1)
file 4 at 0x005b1828 has unknown 4 (subtype 6)
unknown content descriptor 00000007 at 0x005b1838

The first three files are extracted and convert using the MTA2 audio tool, then file 4 encounters the unknown content descriptor and then halts further output. Some musical cues appear to be contained within, files 2 and 3 are the chapter start stingers. (Although, I'm mainly interested in the dialogue.)
by hcs at 2:27 PM EDT on May 31, 2016
@zubren: demux_dat 0.3 fixes this.

edited 2:27 PM EDT May 31, 2016
by zubren at 9:54 PM EDT on May 31, 2016
That worked great! Thank you!
by Jiko at 12:36 AM EDT on June 7, 2016
On DBM files for people confused.
Talking about the MGS4 audio JAR tool, I got it to work by changing the bat.bat and replacing ".mta2" with ".dbm"
I'll copy paste the code here, if you're missing the bat with the .jar

for %%f in (*.mta2) do java -jar AudioTool-decode.jar "%%f"

for %%f in (*.dbm) do java -jar AudioTool-decode.jar "%%f"


Go to Page 0

Search this thread

Show all threads

Reply to this thread:

User Name Tags:

bold: [b]bold[/b]
italics: [i]italics[/i]
emphasis: [em]emphasis[/em]
underline: [u]underline[/u]
small: [small]small[/small]
Link: [url=http://www.google.com]Link[/url]

[img=https://www.hcs64.com/images/mm1.png]
Password
Subject
Message

HCS Forum Index
Halley's Comet Software
forum source