Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Codecs, formats, encoding/decoding of game audio, video and music
mtik333
Posts: 15
Joined: Thu Jul 26, 2018 5:15 am

Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by mtik333 »

Hello.
I wanted to extract WAVE files from packfile.pak inside RTL Ski Springen 2002 installation dir that contains almost all data used by this game. I tried using 49games.bms but it returns wrong signature exception (expected PACK, saw q...).

The thing is that some WAVE contents in this .pak have OK headers, but some not (or I can't understand them). Example of good header:

Code: Select all

52 49 46 46 - RIFF
7E 00 00 57 - chunk size (1459617918)
57 41 56 45 66 6D 74 20 - WAVEfmt
10 00 00 00 - subchunk1 size (16)
01 00 - audio format (1 pcm)
01 00 - num channels (1)
80 3E 00 00 - sample rate (16k)
00 7D 00 00 - byte rate (32k)
02 00 - block align (2)
10 00 - bits per sample (16)
64 61 74 61 - DATA
1E 7E 00 00 - subchunk 2 size (‭32286‬)

Second file has values like below which I do not understand

Code: Select all

52 49 46 46 - RIFF
DA FA 22 09 - chunk size (‭153287386‬)
57 41 56 45 66 6D 74 20 - WAVEfmt
10 23 C0 01 - subchunk1 size (‭29369104‬)
00 02 - audio format (2 - compression?)
80 3E - num channels (‭16000‬ - is it possible?)
23 01 7D 22 - sample rate (‭578617635‬)
C8 02 00 06 - byte rate (‭100664008‬)
64 61 74 61 - DATA (where's the block align and bits per sample?)
B6 FA 20 FF - subchunk2 size (‭4280351414‬)


I can upload part of this .pak file, but now I was wondering if it's possible for WAVE header to miss block align or bits per sample?
Thanks.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by aluigi »

Maybe upload that second sample file
mtik333
Posts: 15
Joined: Thu Jul 26, 2018 5:15 am

Re: Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by mtik333 »

I'm not sure if it's OK to provide attachments here or upload it on external link, but there it is.

In file
start_plus_weird_wave.pak
I included beginning of this .pak file + a couple of weird WAVE headers and data content. The one I mentioned in post starts at 26809 (HEX) / 157705 (DEC) and seems to end at 35008 (HEX) / 217096 (DEC)

In file
good_wave.pak
I included two WAVE headers along with its data content. Header I mentioned starts at 0, but there's a second good one starting at 8000 (HEX) / 32768 (DEC).

UPDATE
When I tried to replace the content of weird header from "WAVEfmt " to "data" with the good one and tried to get sound from it, the result is following (replace extension: .test with .wav):
start_plus_weird_wave.txt

I would expect to hear clean voices there of course - not sure if it's possible to recover it in any way.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by aluigi »

The reason is that these files are compressed.
I didn't find the compression algorithm, I didn't scan them but I just tried 5 of them I had in mind and they failed.
This is the work-in-progress script that canNOT be used until someone finds the correct comtype:

Code: Select all

comtype ???
for
    get ZSIZE long
    get OFFSET long
    get DUMMY long
    get SIZE long
    getdstring NAME 0x40
    if NAME == ""
        break
    endif
    math OFFSET * 0x800
    if SIZE == ZSIZE
        log NAME OFFSET SIZE
    else
        # skip duplicated 64bit SIZE
        math OFFSET + 8
        math ZSIZE  - 8
        clog NAME OFFSET ZSIZE SIZE
    endif
next
mtik333
Posts: 15
Joined: Thu Jul 26, 2018 5:15 am

Re: Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by mtik333 »

Can you tell me which compression algorithms you tried? I asked Sound Designer of this game and he was mentioning potentially ADPCM (game was released on PS1 as well https://problemkaputt.de/psx-spx.htm#spuadpcmsamples, but these samples are from PC version) or Ogg stored as WAVE (is this even possible?)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by aluigi »

lz77wii, lzss, lzo1x and few others.
Please note that compression is meant as lossless data compression and not as audio codec.
mtik333
Posts: 15
Joined: Thu Jul 26, 2018 5:15 am

Re: Weird WAVE header (RTL Ski Springen 2002 / Skoki Narciarskie 2002)

Post by mtik333 »

Sorry for "unearthing" this thread, but I decided to go again working on this stuff. Apparently, I managed to get correct WAV file from demo (ENGELBERG_PL.wav) and its representation in full version of the game (wave412.wav). I also changed the header in wave412.wav to the one from original, so it can be opened in Audacity (engelberg.wav).

What I know is that some files were produced with Sound Forge 4.5 as the reference is present in original PAK file, however I don't think this software could do this kind of conversion. Finally, the game manages to play it without all kind of "chks" and "clicks" that are present in the file that I fetched, so there must be some kind of code that manages to find out, which bits should be used and which not (I have no idea how it could look like in 2001 though, DirectMusic or something like this could do this maybe).

Once comparing the data, it is visible that some chunks of data are correct while other seem to be replaced when loading the data (see the screenshots in ZIP file).

skoki2002wavfiles.zip