Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Codecs, formats, encoding/decoding of game audio, video and music
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

Hello ZenHax community,
Pleasure to meet ya'll. This is my first post here!
So I have a file format that no-one has been able to reverse engineer yet. I have gotten pretty close, but I don't know enough about reading raw audio.
So long story short, the defunct company Eurocom engineered a format (MUSX) as given away by the headers in it's file type less files. These were extracted from a container format which left them all as "File_XXXXXXX.file". I was wondering if someone can help me finally rip the soundtrack from a game they made called "G-Force". Yes, I know, but honestly it has a great soundtrack. If anyone has this game and was curious on how to extract these files, just look at my reddit post below. This is nonconvertible by everything I have tried, but I guess you assumed that. (This includes VGMStream).

Possible specs of files:


    26,000(Most probably) or 32,000 khz sample rate.
    Varying mono to stereo properties.
    ADPCM.
    "4-Bit IMA ADPCM" ness, whatever that means.
    2048 bit offset
    Big-Endian byte order.

Links to research:


https://www.reddit.com/r/REGames/commen ... can_crack/
https://www.reddit.com/r/audiophile/com ... _to_a_wav/
https://github.com/kode54/vgmstream/blo ... eta/musx.c
https://www.google.com/search?num=40&sa ... PEOaV8ZqLk

Please help!
- Tom
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by AnonBaiter »

I would also like to figure out the format as well. I did some converting through VGMToolbox(it has a GENH function), but I wasn't too impressed by the results to be honest.
To be honest though, I would like to help but I don't know how to program a tool dedicated to converting .MUSX files, but I assume the .MUSX format used in Eurocom games might be uncompressed audio. It's just my wild guess, though.

By the way, here's my sample, from Athens 2004(PS2):
https://mega.nz/#!oAVTnTCJ!s3oA6fu2Qnc-tS1aXBRdq4CYHKoimSeJp0pGwuXb5ms
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by id-daemon »

Tough nut? Are you kidding me?

Seems just no one even tried to decode this.

32,000 khz
stereo
Playstation 4bit ADPCM
header skip 0x1000
interleave 0x80

Piece of cake.
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by id-daemon »

And now as for G-Force.

This is MUSX version 10, and vgmstream only supports version 4 (as I know). So after reading about the ver 4 format and changing a couple of values in the header, I was able to decode your music. It is actually Eurocom ADPCM, that was decoded long time ago by HCS, and this is not in any way difficult codec.

Example: http://www30.zippyshare.com/v/jDmrUZwj/file.html

Now we only need to decide, if I write a program to decode it, or you change bytes manually, like I did today.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by AnonBaiter »

id-daemon2 wrote:Now we only need to decide, if I write a program to decode it, or you change bytes manually, like I did today.

I think it's better off writing a program dedicated to decoding MUSX files. It can be any version.

I can also upload more samples if I have the games Eurocom had developed over the years, but I think just that link will do.
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

id-daemon2 wrote:Tough nut? Are you kidding me?

Seems just no one even tried to decode this.

32,000 khz
stereo
Playstation 4bit ADPCM
header skip 0x1000
interleave 0x80

Piece of cake.


I already showed that I figured all of that out. Except the sample rate was wrong. Now I know why. (Long story why it's that.)
I just don't know how to read a 4bit ADPCM.
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

id-daemon2 wrote:And now as for G-Force.

This is MUSX version 10, and vgmstream only supports version 4 (as I know). So after reading about the ver 4 format and changing a couple of values in the header, I was able to decode your music. It is actually Eurocom ADPCM, that was decoded long time ago by HCS, and this is not in any way difficult codec.

Example: http://www30.zippyshare.com/v/jDmrUZwj/file.html

Now we only need to decide, if I write a program to decode it, or you change bytes manually, like I did today.


Wow thank you so much! You are amazing! I can write a program in fact.
What parts did you change to read it, so I know what to change.
Thanks to everyone else who also helped!
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

AnonBaiter wrote:
id-daemon2 wrote:Now we only need to decide, if I write a program to decode it, or you change bytes manually, like I did today.

I think it's better off writing a program dedicated to decoding MUSX files. It can be any version.

I can also upload more samples if I have the games Eurocom had developed over the years, but I think just that link will do.


I'll write one once I know what to change!
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by AnonBaiter »

I very much respect your enthusiasm, but try not to double post next time. Just saying.
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by id-daemon »

BlueMustache wrote:I can write a program in fact.


Very good.

There are different types of 4bit ADPCM. In this example one was PS2 type (Athens), and the other (G-force) was Eurocom version. What would you like to start with? G-force? You need only music, or sound banks too?
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

id-daemon2 wrote:
BlueMustache wrote:I can write a program in fact.


Very good.

There are different types of 4bit ADPCM. In this example one was PS2 type (Athens), and the other (G-force) was Eurocom version. What would you like to start with? G-force? You need only music, or sound banks too?


I would like to extract it all. Since my friend and I are speedrunning the game (which is honestly pretty fun to speedrun), and we want to have the soundtrack and soundeffects.
Just tell me step by step how you changed the headers, please.
Thanks!
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by id-daemon »

Ok. I was wrong. vgmstream supports musx version 10, but not its "PC" version. So the easiest way would be:

1. change 32-bit value at 0x34 to 00 (no loop)
2. change "PC__" at 0x10 to "PS3_" (to make it think its PS3)
3. rename file to .musx

Now vgmstream can decode it with constant samplerate 44100. Change it if needed.

The problem is that vgmstream doesn't work with sound banks at all. So if you want them, you need to write your own decoder, or use this workaround:

1. do steps 1-3 as before.
2. change byte at 0x800 to anything else. (that will make vgmstream think its not a bank)

Now vgmstream can decode it as one big single file. There will be glitches at the beginning of every sound, big static at the beginning (big table of all sounds), and in place of the sounds that are uncompressed plain PCM (like the extractor fan sound you heard already before).
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by id-daemon »

BlueMustache wrote:
id-daemon2 wrote:Tough nut? Are you kidding me?

Seems just no one even tried to decode this.

32,000 khz
stereo
Playstation 4bit ADPCM
header skip 0x1000
interleave 0x80

Piece of cake.


I already showed that I figured all of that out. Except the sample rate was wrong. Now I know why. (Long story why it's that.)
I just don't know how to read a 4bit ADPCM.


Those were values for AnonBaiter's file. First I thought his file was the same as yours (because you didn't provide a sample), then I got to your game.
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

id-daemon2 wrote:Ok. I was wrong. vgmstream supports musx version 10, but not its "PC" version. So the easiest way would be:

1. change 32-bit value at 0x34 to 00 (no loop)
2. change "PC__" at 0x10 to "PS3_" (to make it think its PS3)
3. rename file to .musx

Now vgmstream can decode it with constant samplerate 44100. Change it if needed.

The problem is that vgmstream doesn't work with sound banks at all. So if you want them, you need to write your own decoder, or use this workaround:

1. do steps 1-3 as before.
2. change byte at 0x800 to anything else. (that will make vgmstream think its not a bank)

Now vgmstream can decode it as one big single file. There will be glitches at the beginning of every sound, big static at the beginning (big table of all sounds), and in place of the sounds that are uncompressed plain PCM (like the extractor fan sound you heard already before).


I'll do my best. I'm a noob at vgmstream. Did you just use a hexeditor to change those values? Also, how did you specifically find that one song? Was their a certain numerical bunch that was music, or is it just jumbled up. That song is very early on in the game.
BlueMustache
Posts: 9
Joined: Sun Mar 06, 2016 10:10 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by BlueMustache »

I edited the hex of File_000006.musx to fit your description.
What is the command line input for vgmstream to read / convert this?
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by id-daemon »

It was 154 or 156. Yes I used hex editor.

vgmstream has a good help. Install it into winamp, or just use test.exe as described in help. Or just drop the file onto test.exe
alex137a1
Posts: 3
Joined: Sun Jul 15, 2018 12:33 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by alex137a1 »

id-daemon wrote:And now as for G-Force.

This is MUSX version 10, and vgmstream only supports version 4 (as I know). So after reading about the ver 4 format and changing a couple of values in the header, I was able to decode your music. It is actually Eurocom ADPCM, that was decoded long time ago by HCS, and this is not in any way difficult codec.

Example: http://www30.zippyshare.com/v/jDmrUZwj/file.html

Now we only need to decide, if I write a program to decode it, or you change bytes manually, like I did today.


How exactly? What have you changed in the header?
alex137a1
Posts: 3
Joined: Sun Jul 15, 2018 12:33 pm

Re: Converting the Eurocom (.MUSX) DAT4 IMA ADPCM Format

Post by alex137a1 »

Bumping the thread once again.
How the hell can I convert MUSX V10 into something that can be played? What values in file's header or anything else can be done?