Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

.gin and .abk sound formats (Need for Speed mw 2005)(help)

Featured Replies

  • Author
  • Localization

V12-POWER, posted Sun Oct 04, 2015 3:34 am (8001)


Tropod wrote:
Have just tried this with one of the SC4 AB files, & it spat out 35 WAV files :o :shock:. Some of which appear to be in a different language. Some of them too sound like they're playing at the wrong tempo (ie rate). If need be I can upload some of these for troubleshooting if that helps or help with (c/c ) code if you're not sure of some parts?

cheers


it's about encoding now, I tried the decoder and it works for nfs pro street files even, but you need to get the gin files manually by hex editing. There's also guys from GTRCars interested in writing some form of encoder, but daemon has the last word
  • Replies 237
  • Views 26
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Localization

id-daemon, posted Sun Oct 04, 2015 6:40 am (8003)


V12-POWER wrote:
For gin files, the table is a bunch of arrays, which is independent of file size... the big int-array is "not really that important"


I don't know how it may not be important, it depends on file size and it contains the sample numbers from the audio. This example for Ferrari having 149237 samples

Image

first array is always 51 numbers

Image

size of the second depends on file size and forms a curve
  • Author
  • Localization

id-daemon, posted Sun Oct 04, 2015 6:44 am (8004)


Tropod wrote:
I can upload some of these for troubleshooting


Yes, some sounds have no sampling rate, so I assume them to be 22050hz like it was stated in EA wiki. If you know how these should sound in game, please send them.
  • Author
  • Localization

V12-POWER, posted Sun Oct 04, 2015 1:14 pm (8019)


id-daemon2 wrote:
V12-POWER wrote:
For gin files, the table is a bunch of arrays, which is independent of file size... the big int-array is "not really that important"


I don't know how it may not be important, it depends on file size and it contains the sample numbers from the audio. This example for Ferrari having 149237 samples

Image

first array is always 51 numbers

Image

size of the second depends on file size and forms a curve


there are 2 fields at the header that give us how many fields for each array. however if you use or create an array yourself you can still use it and have the sound unchanged, by hexediting. I tested this with almost any car there is, so that's why I said it's not that important but I might be wrong, your decoder works with nfscarbon and pro street gins (manually getting the .gin out of the .tmx audio file) with sampling rate of 44.1khz, common in almost every audio file from NFSC onwards, but .abk has received a update, yet it's very similar to BNK1 section, has relative offsets, sample rate and more info in this section
  • Author
  • Localization

id-daemon, posted Sun Oct 04, 2015 3:16 pm (8023)


V12-POWER wrote:
you can still use it and have the sound unchanged


Ok good then, it must be some kind of seektable that is not used in this case. I can just say that

24-27 -> total number of samples
28-31 -> sampling rate

Good to know that decoding works with many games. I don't know where to proceed now. Should I dig into new ABK formats or something?

I saw someone on GTRCars reversed my EXEs, but that was not a secret, I told you about codec types here. There's no reason comparing them with ffmpeg codecs, this will not help at all.

Also I tried replacing CAR_21_ENG_MB_EE.abk (VW GTi) with other files, like CAR_50_ENG_MB_EE.abk and engine sounds wrong (almost silent). It seems they are dependent on some other files. Do you know anything about it?
  • Author
  • Localization

id-daemon, posted Sun Oct 04, 2015 4:03 pm (8027)


I made some tests. Replaced CAR_21_ENG_MB_EE_01.wav with some music loop, encoded it with

sx.exe -raw -eaxa_blk CAR_21_ENG_MB_EE_01.wav -=1.bin

and hex-inserted it into ABK.

As a result you can hear music instead of engine idle on VW GTi. So this prooves we can change sounds with the same number of samples with original EA tool SX.exe and we don't need an encoder for that.
  • Author
  • Localization

V12-POWER, posted Sun Oct 04, 2015 9:01 pm (8069)


fuuuaarrrrkkkkkk that was awesome. now I see that you used the same offsets, can we start working towards adding more samples? I understand how this section works, not that hard to understand by looking at the files. there's the version, number of samples, total audio size, the PT offset array, everything
  • Author
  • Localization

id-daemon, posted Mon Oct 05, 2015 4:18 pm (8084)


Ok, today I replaced that idle sound with 7-seconds long music sample. Instead of rebuilding the whole ABK file I just append it to the end and chang offsets and sizes. You know what? It plays.

Still I can't understand why swapping two ABK files doesn't work right.
  • Author
  • Localization

V12-POWER, posted Mon Oct 05, 2015 5:41 pm (8092)


It's not that it does not works, it's just that the ABK forms the whole engine sound, so exchanging them can break the structure of the sounds. you don't even need to change the whole .abk, just changing the first part will destroy the sound. If you pay attention to the file you gave me (with the song sample) you can hear that it plays in the wrong tempo when in game. I can dig into this part as I know it's crucial for development.
btw, when I use the same lines (sx.exe -raw -eaxa_blk CAR_21_ENG_MB_EE_01.wav -=1.bin) it gives me a 37,5kb .bin file, not really compressing it at all, so I can't put it in the ABK because the sizes are not identical.
  • Author
  • Localization

id-daemon, posted Mon Oct 05, 2015 6:21 pm (8098)


I'm using SX.exe v3.01.01, whats your version?
  • Author
  • Localization

id-daemon, posted Mon Oct 05, 2015 6:36 pm (8099)


V12-POWER wrote:
... exchanging them can break the structure of the sounds. you don't even need to change the whole .abk, just changing the first part will destroy the sound


Yes, changing some bytes in ABK can destroy the sound, because it will not be a proper ABK. But if we use one ABK instead of another, it will be proper ABK, how come it doesn't work?
  • Author
  • Localization

V12-POWER, posted Mon Oct 05, 2015 6:40 pm (8100)


id-daemon2 wrote:
V12-POWER wrote:
... exchanging them can break the structure of the sounds. you don't even need to change the whole .abk, just changing the first part will destroy the sound


Yes, changing some bytes in ABK can destroy the sound, because it will not be a proper ABK. But if we use one ABK instead of another, it will be proper ABK, how come it doesn't work?


I mean, the data from byte 92 till 9856 (decimal) in car 21 eng, it's that part which makes the sound. Im using the latest version, same as yours
  • Author
  • Localization

id-daemon, posted Mon Oct 05, 2015 6:52 pm (8101)


V12-POWER wrote:
Im using the latest version, same as yours


very strange then. it gives me 10k 1.bin
  • Author
  • Localization

V12-POWER, posted Mon Oct 05, 2015 7:08 pm (8102)


out of curiosity, have you looked at the text files that I uploaded?
  • Author
  • Localization

id-daemon, posted Mon Oct 05, 2015 7:14 pm (8103)


yes
  • Author
  • Localization

V12-POWER, posted Mon Oct 05, 2015 7:36 pm (8104)


I'd say that we start with the hardest first, an encoder for gin files if you're up to it. There are guys from gtrcars that might help if you or I contact them. There's also a mod, called Golden Muscle Era which replaced every music file (not engine sounds sadly) I suppose that the NFSMW music files use the same or similar codec, which we can also see if they are still alive. I also think this is the first logical step because the gin format is the same for all NFS games from NFS UG to NFS Undercover.

I am gonna try to fully understand the abk format once and for all (talking about the first data section before BNKl header and then the last array table) since this does not requires a new encoder, just understanding of how it's made
  • Author
  • Localization

id-daemon, posted Mon Oct 05, 2015 8:30 pm (8107)


No, music use the same codec as ABK files.

The last array table is table of offsets in the first data section.

What about ABK files, are they different for other games? What do they use it for? Engine sounds or something else?
  • Author
  • Localization

V12-POWER, posted Mon Oct 05, 2015 9:14 pm (8108)


id-daemon2 wrote:
No, music use the same codec as ABK files.

The last array table is table of offsets in the first data section.

What about ABK files, are they different for other games? What do they use it for? Engine sounds or something else?


the abk files are used for almost any sound fx in these NFS games, NFSUG onwards. all except speeches and music.

Basically the ABK files received a small update in the transition to NFSCarbon, it is really identical to the abk files you're working with now (NFSMW2005), the big data section at the start, the offset table at the end, sound ID, all the same but instead of a BNKl section, we have this

Image

all in big endian. in this case we had only 1 sample but it's the same for more. The audio data offset is relative to it's position in the file. And for the rest of the offsets, we have to start counting from the first given audio data offset onwards. frequency is 44.1khz, same as the .gins from NFSPS and NFSUC.

so if audio data offset 1 is at offset 100, audio data offset 2 value, lets say 120, we have to start counting from offset 100 because audio data offset 1 is at such offset, hope it clears some stuff. I also don't know if these new abk use the same codec or not.

edit: for now it seems like the first part of the data is a big clusterfuk...a lot of relative offsets, but the standpoint is unknown really, some are fixed some not.
  • Author
  • Localization

id-daemon, posted Tue Oct 06, 2015 4:22 pm (8133)


Good news. Now i know why swapping ABK files didn't work. They have car ID at 0x126c. Just change that ID and you can replace any car ABK with another. That proves that there's nothing specific for different ABK files and the game can use any of them if needed.

Bad news is that ABK structure has a lot of sound properties and I don't think we can ever identify them all. Let's just hope we can identify those that you really need.

As for encoder, this is not a problem. I did that before and I'm sure I can do this. Just need some time.

What about newer NFS games, like 2009 or later? Do they use any of ABK or GIN formats?
  • Author
  • Localization

V12-POWER, posted Tue Oct 06, 2015 5:12 pm (8144)


id-daemon2 wrote:
Good news. Now i know why swapping ABK files didn't work. They have car ID at 0x126c. Just change that ID and you can replace any car ABK with another. That proves that there's nothing specific for different ABK files and the game can use any of them if needed.

Bad news is that ABK structure has a lot of sound properties and I don't think we can ever identify them all. Let's just hope we can identify those that you really need.

As for encoder, this is not a problem. I did that before and I'm sure I can do this. Just need some time.

What about newer NFS games, like 2009 or later? Do they use any of ABK or GIN formats?


the gin and abk was dropped after NFSUndercover, because they no longer used the EAGL engine. after this you have a lot of formats from different engines, chameleon, nfs shift formats and frostbite formats, which we all know how long they took to decode let alone encode which is not even done yet.

I can understand what the sound properties do with trial and error as the data is uncompressed. The last section, however, has some interesting properties, right before the BNKl section. I am going to test what does this part affects and then go with the rest. It would be of real help to parse all the strings using the offset table at the end, because it seems like there are many of them that are similar (same lenght, varied information, same byte signatures, etc)
  • Author
  • Localization

id-daemon, posted Tue Oct 06, 2015 5:21 pm (8147)


Right before the BNKl section there are some tables forming sort of curves like on the pictures I posted before. Wonder what they can be used for.

How would you like me to output the parsed strings?
  • Author
  • Localization

V12-POWER, posted Tue Oct 06, 2015 7:10 pm (8155)


id-daemon2 wrote:
Right before the BNKl section there are some tables forming sort of curves like on the pictures I posted before. Wonder what they can be used for.

How would you like me to output the parsed strings?


yea that table is the same across all car sounds, and the offsets for this table/curve are given at the "middle" of the section (the section that follows the car ID byte) however it seems to vary when you look at turbo sound files and more sfx. it hasn't got that much effect in the sound however (it contains volume for engine set actually but just that)

using the offset table, we would be left with a bunch of byte sequences. some are similar in lenght (12, 15, 18 bytes most common) I tell you this because it seems like this information cant be changed or shared across abk files. I tried cutting a small part with the same size and the game crashed. It's strange cause it doesn't seem to contain any obvious information, but i'll keep playing with them

edit: it does not crash now, forgot to edit the array table offset at the header and file size. definetly, the first part is where the sound filters, effects and crossfade are made/stored.
  • Author
  • Localization

id-daemon, posted Wed Oct 07, 2015 7:07 pm (8194)


I see no big reason for changing GIN files, its hardly even heard in game. Most of the engine sound is formed from that ABKs 8 samples:

1 - low idle
2 - idle
3 - low slowdown
4 - high slowdown
5 - low speedup
6 - middle speedup
7 - high speedup
8 - overrev
  • Author
  • Localization

V12-POWER, posted Wed Oct 07, 2015 8:51 pm (8195)


id-daemon2 wrote:
I see no big reason for changing GIN files, its hardly even heard in game. Most of the engine sound is formed from that ABKs 8 samples:

1 - low idle
2 - idle
3 - high slowdown
4 - low slowdown
5 - low speedup
6 - middle speedup
7 - high speedup
8 - overrev


well just the opposite is what I think, having the original gin files with new sounds sort of killed the modded sound set. However we can "replace" the need for gin files by using more samples and make the engine rpm buildup with more than 8 samples. Anyways, if the idea is to move to NFSPS or NFSUC then sooner or later we will need to change gin files as the engine sounds are purely gin files inside the .tmx
  • Author
  • Localization

id-daemon, posted Thu Oct 08, 2015 4:48 am (8204)


Can you give me an example of a car where I can hear GIN file? Because on low end cars I almost can't hear it.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.