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

Codecs, formats, encoding/decoding of game audio, video and music
Moussa Bayou
Posts: 12
Joined: Tue May 16, 2017 12:52 pm

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

Post by Moussa Bayou »

Hello.
Um guys from where could I get sx.exe (sound exchange)?and if you have it can you send it to me?
Thanks a lot. :)
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

Alright after 2 years without a capable PC im back. Im currently investigating/modding NFS Pro Street .tmx sounds.

The tmx has both gin files and the snr format which can only be opened in audacity but some guy on this forum said it wasn't possible to encode custom files back, need confirmation on this one though. The game has no issues reading modified tmx files, gin files can be any size or length.

SNR format is pretty much used for tones of the rpm range, much like the .abk format in previous games so unless someone makes an encoder, we're not 100% able to accurately modify sounds.

There are some float values present in the header, some very obvious ones which im 90% sure they are related to the rpm range of the sound set and others which have unknown purpose but I still think they're related to sound properties only. Luckily there is no assembly code in the .tmx format unlike the older .abk.

On the subject of using custom gin files, it isn't as straight forward as in NFSMW or Carbon, where you could hear the modified audio clearly almost with no changes or differences. In this game it's different, the audio files change a lot. (Needless to say that there are much more in-game parameters to try and modify from the database using this tool https://nfs-tools.blogspot.com/2017/09/nfs-vlted-v45-released.html I didn't even start playing with it though)


But going back to the files, it's hard for me to really pinpoint what's really happening with the audio. My test is simple, I swapped the gin acceleration file with a locomotive idling sound.

It's easy to recognize the sound in game, but it's morphed to something entirely different; I will upload a short video tomorrow maybe.

If someone wants to start testing things up just reply here, im gonna see what's possible with this game
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

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

Post by id-daemon »

V12-POWER wrote:My test is simple, I swapped the gin acceleration file with a locomotive idling sound.

i recommend swapping it with human speech, it will allow you to know exactly what happens with the sound
thats what i did when researching GIN files
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

id-daemon wrote:i recommend swapping it with human speech, it will allow you to know exactly what happens with the sound
thats what i did when researching GIN files


thats a better alternative for sure lol. Haven't had time though to upload the video but will do in these days
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

Here it is, an example of what happens with the sound files. I modified the exhaust file which seems to be the one with priority over engine sound file. Used a donald trump speech (lol) and there's the result. He sounds like a cheap chipmunk remix I don't know why does this happen, but it is not the encoder that's giving a corrupt file. This is car_026-exhaust.tmx file for those interested, the acceleration gin file is the last one so it's pretty easy to test modified audio files.

https://youtu.be/TCvde7XwN08

original sample:

152 elements
32khz
max rpm 6596
min rpm 1210

modified sample:

152 elements
32khz
max rpm 6596
min rpm 1210


Edit: shit I guess the pitch change is done by the game .exe and not done in the files and their parameters. I even tried using a lower pitched version of the speech but it sounds the same anyways. Different data for these audio parameters doesn’t work also
Or it could be that the gin file is pitched according to the high rpm tone which is a SNR audio file.
Strange thing is I can import these files to audacity but don’t know which format it is so I can’t modify these

EDIT 2: Yes sadly the pitch change is done by something else. Not the SNR audio files, not the tables in the header and not in the game database values, it is the exe doing it im 80% sure. fukkk
zimex25
Posts: 31
Joined: Wed Dec 09, 2015 11:59 am

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

Post by zimex25 »

I trying in NFSU2 but tools didn't work... Idk maybe I do something wrong or tools didn't support U2 but It's possible to simple tool?
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

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

Post by id-daemon »

V12-POWER wrote:Here it is, an example of what happens with the sound files.

I dont understand whats wrong here. Why do you think it must be different?
It seems this sound is supposed to be like this.
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

id-daemon wrote:
V12-POWER wrote:Here it is, an example of what happens with the sound files.

I dont understand whats wrong here. Why do you think it must be different?
It seems this sound is supposed to be like this.


Not really, because when you add an actual engine sound sample you hear it totally different, sounds like a high pitched hiss, yet the original/un-modded sample sounds the same in game and after decoding. The original sample of the sound set is audible and it's correct. It's when you remove it and put a different one back in that this happens.

And for some reason, making the modified sample have a lower pitch/deeper voice still sounds very high pitched in game, so source file pitch is irrelevant it seems. Also, the ENGINE sound set is fine with different audio samples, they sound the same in audacity and in game, the EXHAUST set causes this problem (on this car)
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

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

Post by id-daemon »

Ok then, if i understand correctly, this game analyzes the sample pitch, and shifting it like its supposed to be in game.

It must be set with some parameters, just like you said. It can't be set in EXE.
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

id-daemon wrote:Ok then, if i understand correctly, this game analyzes the sample pitch, and shifting it like its supposed to be in game.

It must be set with some parameters, just like you said. It can't be set in EXE.


EDIT: Found what causes the pitch change. The infamous tables of the gin file, it seems the game expects both tables to have certain values. If you use the original tables with a modified sample it works. This comes with a problem though, the sample will not be played correctly.

Same test as the video above, same file, same car, same sample, only difference is, im now using default gin tables. The sample plays correctly but not on it's entire length, you can listen to the video and see it plays the whole speech. "...but we have people that are stupid" as it's supposed to do.

Now, it plays the sample till the "...but we have pe-" part, it's lacking a good part of it.

While we solved one thing, we opened another can of worms, damn

EDIT2: The pitch can be manipulated using different number of elements for the table, depending on the sample rate and sample length. General rule is longer sample bigger table, higher sample rate bigger table, etc. But, oddities can happen, I have extracted the following from a few mins of file extracting and etc, the first and second have similar lengths but they differ in the number of elements, you would expect the smaller sample to have less elements, but its the opposite, the rest all follow the longer = bigger rule.

Y = ELEMENTS
X = SAMPLE LENGTH

Y = 175, X = 4415ms // 32kHZ
Y = 151, X = 4607ms // 32kHZ
Y = 173, X = 5183ms // 32kHZ
Y = 386, X = 11604ms // 32kHZ
Y = 194, X = 6965ms // 44.1kHZ
Y = 219, X = 7848ms // 44.1kHZ
Y = 629, X = 13003ms // 44.1kHZ

Now I might do something so that editing these files is easier...doing it all by hand takes way too much time, should be easy now that the format is easy and has all the necessary data, if someone is wondering, here is what I have so far

0x00 - Id, long

now we skip some bytes since theyre useless for this

0x58 - data block 1 size/offset, gin/snr section begins after this
0x5c - data block 1 + gin/snr section size (audio data begins after this)

skip all the bytes till the offset given in 0x58, Gin and SNR section begins, each sample present in the file has an string of 36 bytes in ths section. It's easy to guess the number of audio files by just doing 0x5c - 0x58 and dividing by 36.

anyways, to the small section here.

0x00 - file format
0x04 - file enumeration (first file is always 00)
0x08 - audio data offset. To get the actual offset in the file, you must add the value you got frmo 0x5c at the beginning to this one

skip 8 bytes

0x14 - random byte is always 01

skip 4 bytes

0x1c - RPM of sample, used for SNR files since they're supposed to be recorded at a static rpm, gin files use a value of 1000


skip 4 bytes

0x24 next audio file string...

The only problem here is to obtain the size of the last sample. Its easy to get the size of the files before the last one, just substracting one offset from another gives the file size, but for the last one we only have the offset - even though we know it goes all the way to the end of the file.
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

id-daemon wrote: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


May I know where or how did you generate the graphs?

Uh and the SNR files can be decoded, but cant be encoded back with ffmpeg...is an encoder anywhere to be found? I know people use ea layer to encode SNR codec 5 but thats another format you see..
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

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

Post by id-daemon »

V12-POWER wrote:May I know where or how did you generate the graphs?

i dont remember
these are excel graphs, it means i got their data from some files
V12-POWER
Posts: 71
Joined: Thu Jul 02, 2015 10:43 pm

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

Post by V12-POWER »

So this is what the custom sounds, sound like. For some strange reason they are a distorted mess, for some other reason, human speeches sound fine in game after fixing the pitch (Not 1 to 1, but close enough) Here's an example.

https://www.youtube.com/watch?v=xiajpcdTx6E&

If this is a problem while encoding, then that's way out of my skills, I can't do anything about that, so it's open to anyone who wants to keep on with it. The source file is from GRID Autosport btw.

It is not a problem with parameters, neither the source files, all files from GRID sound distorted in game

id-daemon wrote:
V12-POWER wrote:May I know where or how did you generate the graphs?

i dont remember
these are excel graphs, it means i got their data from some files


Ok, ty.
chung390
Posts: 1
Joined: Sun May 26, 2019 2:40 pm

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

Post by chung390 »

I have a question.
How can I see the number of elements in the decoded .GIN?
LBPPlayer7
Posts: 23
Joined: Mon Jul 17, 2017 10:36 am

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

Post by LBPPlayer7 »

This page has screenshots from the AEMS editor. Sure, it's not from an NFS game, but it's still the same audio engine used for engine audio from ABKs. This could possibly clear up some small things about the ABKs.
http://designingsound.org/2010/01/27/au ... ts-part-2/
BrahmaBull
Posts: 2
Joined: Tue Mar 30, 2021 10:04 am

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

Post by BrahmaBull »

Hello, has anyone been trying to follow V12’s tutorial on youtube and failing?

Im stuck to the step 2, where you need to use the start.bat to convert your wav files into gin files.
For some reason when I run the start.bat, program is working on the cmd, but when its done I have no gin files at all like they appear on the video…

That is frustrating, I really want to replace some audio files on nfs hot pursuit remastered.
YaroslavTsapov
Posts: 1
Joined: Fri Jan 21, 2022 8:36 pm

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

Post by YaroslavTsapov »

Hi anyone, who still live:) I need in your help, brothers. The tutorial is interested, but i didn't understand since 3 years ago to today how to return .gin and .abk format from .wav files. If V12 POWER didn't delete his videos on YouTube, may be i understood this earlier. but now i don't know: how to convert modified or original .wav to .abk and .gin...:(