Getting the sounds out of MW2.PRJ

General Mech2 related Developments go here. Discussions welcome!

Moderator: Skyfaller

Forum rules
If you are writing a guide please do not post it here! Post in the Dev FAQ section please.
User avatar
DracoNihil
I.S. Baby
Posts: 7
Joined: Sat Sep 01, 2012 5:42 am
Location: San Diego, CA
Contact:

Getting the sounds out of MW2.PRJ

Post by DracoNihil »

About a few years back, when I first discovered the program Audacity (it was a REALLY old version too), I decided to randomly import the MW2.PRJ file as a Unsigned 8-bit Little Endian PCM file at 11025 Hz... now this obviously plays alot of garbage, but around near the end regions of the file you can hear some of the mission voices, and a few of the weapon sounds.

The problem is, while these sounds DO appear to be a form of Linear PCM, but it's arranged in such a way that you can't just play it like that. There's these intermittent "popping" sounds in the audio streams, and looking around online for similar cases it pretty much seems the audio in Mech2 is segmented into tiny blocks... why I don't know. The only other game I know that does this is Lego Island. There's also some audio that is completely distorted and I can only think the reason is because it uses some form of audio compression, maybe a form of ADPCM.

It's possible to get the sounds to sound like they do in the game, but it involves me having to cut out the "pops" to make the wave contiguous, this is very tedious and I'm researching a way to interpret how these sounds are structured so I might have a easier way to get at these. As for the severely distorted audio I just mentioned, I wouldn't know a thing about it unless I somehow made it play in-game and reverse engineer what might happen in the assembly.

One of the reasons I want to extract these things is because I like to have all of the campaign mission voices in one big playlist because I'm weird like that.

There's also alot of unused sound data in the MW2.PRJ file (atleast in the case of Mercenaries), like "Enemy Destroyed." and different versions of "Enemy Mech, Destroyed." and also "Tertiary Objective Successful" which I've never heard of in the game as far as I've played. I guess these are all left over from beta development.

It would really be nice to have the entire audio library in Mech2 to be extracted in full, I like collecting audio from games. Has anyone else ever tried getting at the audio files embedded in the MW2.PRJ?
“I am a dragon without a name.”
User avatar
Demonslayer
House Steiner Private First Class
House Steiner Private First Class
Posts: 76
Joined: Wed Apr 13, 2011 5:53 pm
Location: United states/Texas/Houston

Re: Getting the sounds out of MW2.PRJ

Post by Demonslayer »

nope im still trying on extracting and replacing but skyfaller has not been on in a awhile to help
User avatar
DracoNihil
I.S. Baby
Posts: 7
Joined: Sat Sep 01, 2012 5:42 am
Location: San Diego, CA
Contact:

Re: Getting the sounds out of MW2.PRJ

Post by DracoNihil »

Well I just made a interesting discovery...

Some of the audio files that aren't popping are actually RIFF Wavefmt .WAV files... Most of them seem to be just ambiant sounds use in various missions. These are really easy to rip with something like HyperRipper or with a simple hex editor like frhed.

Still trying to figure out what these blocked PCM sounds are, and if there's an easy method to "unblocking" them. No luck on figuring out if Mech2 uses compressed audio either. (if it does I'm still assuming it uses ADPCM since the soundblaster cards could handle these in hardware without having to be decoded first in software)

EDIT: Some of the .WAV files appear to have been made in GoldWave. But there's no version information in the metadata tag.

Code: Select all

LISTJ   INFOISFT>   File created by GoldWave.  GoldWave copyright (C) Chris Craig 
EDIT 2: Sound blocks appear to start out like this:

RIFF Wavefmt .WAV

Code: Select all

DATA<bh:fa>~<bh:02><bh:00>j<bh:d8>-<bh:01>SNDS6<bh:00><bh:0e><bh:09><bh:cc><bh:07><bh:00><bh:00><bh:b3><bh:02><bh:01><bh:00><bh:00><bh:00>LONGSHIP<bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00>LONGSHIP.WAV<bh:00><bh:00><bh:00><bh:00>
"SFL"

Code: Select all

DATA<bh:1f><bh:80><bh:00><bh:00><bh:83>+?<bh:00>SNDS5<bh:00><bh:0e><bh:09><bh:cc><bh:07><bh:00><bh:00><bh:a9><bh:02><bh:01><bh:00><bh:00><bh:00>MAS1001S<bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00>MAS1001S.SFL<bh:00><bh:00><bh:00><bh:00>
Whatever this "SFL" format is, it's Unsigned 8-bit PCM that's blocked into short segments... I don't really understand why someone would segment a PCM stream into little tiny pieces, for memory reasons? If that's the case why are there standard RIFF Wavefmt files in the .PRJ? It's only for ambient sounds that loop... all the voices and oneshot sounds like weapons and such are SFL files.

In either case, here's what the first 25 bytes of a SFL file look like:

Code: Select all

SFLX<bh:e5><bh:7f><bh:00><bh:00>:<bh:01><bh:00><bh:00><bh:80><bh:00><bh:00><bh:05><bh:80><bh:7f><bh:82><bh:85><bh:7f><bh:81><bh:81><bh:7f><bh:80>
Sorry for the unreadability, frhed the hex editor I use appears to copy non standard ASCII characters as <bh:(hexadecimal value)>...

EDIT 4 (this is ridiculous): Each of the "pops" in a SFL file occur at every 129 byte interval... To playback a SFL properly without hearing pops you should disregard each 129th byte during playback. This includes ignoring the first byte of the start of the audio stream. (It too is a piece of the "segment" for whatever reason) As for the header information of a SFL file itself, I'm still investigating this.

EDIT 5: CORRECTION: 130 byte interval... I miscounted by 1, sorry about that!

EDIT 6: As proof that my theory about $05 occurring every 130th byte in a SFL, here's a few "extracted" SFL's converted to proper WAV files, enjoy!
Attachments
Mech2soundexample.zip
A few common sounds from NET.PRJ
(62.25 KiB) Downloaded 1009 times
“I am a dragon without a name.”
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Getting the sounds out of MW2.PRJ

Post by Skyfaller »

Back!

Please use MechVM's "View File" with MW2.prj or database.mw2 to explore and export content from these archives.
Let me know if you need further help.
User avatar
DracoNihil
I.S. Baby
Posts: 7
Joined: Sat Sep 01, 2012 5:42 am
Location: San Diego, CA
Contact:

Re: Getting the sounds out of MW2.PRJ

Post by DracoNihil »

Welcome back. And cool I wasn't aware you had something that could explore this file internally, though I'm having a bit of fun myself figuring it out on my own. I'll check out MechVM.

EDIT: Aha, I see MechVM has trouble poking at the same audio files I'm trying to get at... very interesting. I'm still clueless as to what the point of a "SFL" file is though.
“I am a dragon without a name.”
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Getting the sounds out of MW2.PRJ

Post by Skyfaller »

Use the context menu to export and convert files while exploring mw2.prj. Most file formats are accessible. SFL was a sound file, IIRC. You can export entire directories or all of mw2.prj that way.

"View File" was probably the earliest feature in MechVM.
User avatar
DracoNihil
I.S. Baby
Posts: 7
Joined: Sat Sep 01, 2012 5:42 am
Location: San Diego, CA
Contact:

Re: Getting the sounds out of MW2.PRJ

Post by DracoNihil »

Thanks to your tool Skyfaller I can probably work on making my own "SFL -> WAV" converter, but I just need to figure out what the format of some of these SFL's are since they do not all appear to be Unsigned 8-bit PCM. The ones I can't poke at with audacity, SoX and a hex editor play really bad in MechVM. (really loud pops, audio distortion towards the end in some cases)

I also really like how your tool can view the model format, and all the source code is free too so that I can learn from it?
“I am a dragon without a name.”
User avatar
Demonslayer
House Steiner Private First Class
House Steiner Private First Class
Posts: 76
Joined: Wed Apr 13, 2011 5:53 pm
Location: United states/Texas/Houston

Re: Getting the sounds out of MW2.PRJ

Post by Demonslayer »

but skyfallers mechvm is a little buggy when it comes to replacing files so be careful :?
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Getting the sounds out of MW2.PRJ

Post by Skyfaller »

MechVM is open source. You can find the link to the source code in my signature.

I confirm that some sound files play badly. Please let me know if you can fix it.
User avatar
Demonslayer
House Steiner Private First Class
House Steiner Private First Class
Posts: 76
Joined: Wed Apr 13, 2011 5:53 pm
Location: United states/Texas/Houston

Re: Getting the sounds out of MW2.PRJ

Post by Demonslayer »

but can you fix the problem with replacing files in the prj for me please?
Post Reply