Page 1 of 2
Rayman Legends PC Audio Container
Posted: Fri Aug 16, 2013 3:02 am
by !!!!!
The audio in Rayman Legends on PC uses a PCM & ADPCM container unknown to me. No RIFF header for either however playing the PCM files raw works with clipping in the intro. (Obviously the header) ADPCM though doesn't work even creating a Microsoft ADPCM GENH file.
PCM:
ADPCM:
Re: Rayman Legends PC Audio Container
Posted: Mon Aug 19, 2013 9:01 am
by AlphaTwentyThree
Have you tried all XORs? You can find the script in my big topic. Cut the header first of course. If you have found out the XOR, just use the same script to process the whole file (explanation inside).
Re: Rayman Legends PC Audio Container
Posted: Tue Aug 20, 2013 1:34 pm
by !!!!!
AlphaTwentyThree wrote:Have you tried all XORs? You can find the script in my big topic. Cut the header first of course. If you have found out the XOR, just use the same script to process the whole file (explanation inside).
I'm not sure I understand, I've tried the script though I don't think it'll be useful in my hands. I have no idea what to do with it.
RLpcm&adpcm.rar
Here's a quick rar with 2 audio files, one pcm and adpcm if anyone wants to try their hand.
Re: Rayman Legends PC Audio Container
Posted: Tue Aug 20, 2013 5:38 pm
by AlphaTwentyThree
No XOR needed, PCM files are ok.
Need more ADPCM samples.
Re: Rayman Legends PC Audio Container
Posted: Wed Aug 21, 2013 12:32 am
by !!!!!
AlphaTwentyThree wrote:No XOR needed, PCM files are ok.
Need more ADPCM samples.
Here's 5 more ADPCM samples
RL5adpcm
Re: Rayman Legends PC Audio Container
Posted: Sun Aug 25, 2013 2:26 pm
by AlphaTwentyThree
Ok, found the time to write the script. Had to implement the generic header first.
Try if this works:
Code: Select all
# convert *.wav.ckd audio files from Rayman: Legends
# (c) 2013-08-30 by AlphaTwentyThree of XeNTaX
# script for QuickBMS http://quickbms.aluigi.org
get DUMMY long
idstring "RAKI"
goto 0x10
getDstring TYPE 4
get OFFSET long
FindLoc GO string "data" 0 ""
math GO += 8
goto GO
get SIZE long
get CODEC short
get CH short
get FREQ long
set NAME ""
if TYPE == "pcm "
set BLOCKALIGN 4
set BITS 16
callfunction PCM 1
elif TYPE == "adpc"
set BITS 4
set INTERLEAVE 0x8c
set CODEC 0xb
callfunction GENH 1
endif
startfunction PCM
endian little
set PRE SIZE
math PRE += 0x2c
putVarChr MEMORY_FILE PRE 0
log MEMORY_FILE 0 0
set MEMORY_FILE binary "\x52\x49\x46\x46\x20\xC0\xB1\x00\x57\x41\x56\x45\x66\x6D\x74\x20\x10\x00\x00\x00\x01\x00\x02\x00\x44\xAC\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00\x64\x61\x74\x61\xFC\xBF\xB1\x00"
append
log MEMORY_FILE OFFSET SIZE
append
set RIFFSIZE SIZE
math RIFFSIZE += 36
set AVGBYTES FREQ
if CODEC != 2
math AVGBYTES *= BLOCKALIGN
endif
putvarchr MEMORY_FILE 0x04 RIFFSIZE long
putvarchr MEMORY_FILE 0x14 CODEC short # wFormatTag: Microsoft PCM Format (0x0001)
putvarchr MEMORY_FILE 0x16 CH short # wChannels
putvarchr MEMORY_FILE 0x18 FREQ short # dwSamplesPerSec
putvarchr MEMORY_FILE 0x1c AVGBYTES long # dwAvgBytesPerSec
putvarchr MEMORY_FILE 0x20 BLOCKALIGN short # wBlockAlign
putvarchr MEMORY_FILE 0x22 BITS short # wBitsPerSample
putvarchr MEMORY_FILE 0x28 SIZE long
if NAME == ""
get NAME basename
string NAME += ".wav"
endif
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
endfunction
startfunction GENH
get FSIZE asize
math FSIZE += 0x1000
putVarChr MEMORY_FILE FSIZE 0
log MEMORY_FILE 0 0
putVarChr MEMORY_FILE 0 0x484e4547 long
putVarChr MEMORY_FILE 0x4 CH long
putVarChr MEMORY_FILE 0x8 INTERLEAVE long
putVarChr MEMORY_FILE 0xc FREQ long
putVarChr MEMORY_FILE 0x10 0xffffffff long
set SAMPLES SIZE
math SAMPLES *= 8
math SAMPLES /= BITS
putVarChr MEMORY_FILE 0x14 SAMPLES long
putVarChr MEMORY_FILE 0x18 CODEC long
math OFFSET += 0x1000
putVarChr MEMORY_FILE 0x1c OFFSET long
putVarChr MEMORY_FILE 0x20 0x1000 long
putVarChr MEMORY_FILE 0x300 FSIZE long
putVarChr MEMORY_FILE 0x304 0x32304756 long
putVarChr MEMORY_FILE 0xfff 0 byte
math FSIZE -= 0x1000
append
log MEMORY_FILE 0 FSIZE
append
get NAME filename
string NAME += ".genh"
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
endfunction
Re: Rayman Legends PC Audio Container
Posted: Fri Aug 30, 2013 2:05 pm
by !!!!!
AlphaTwentyThree wrote:Ok, found the time to write the script. Had to implement the generic header first.
Try if this works:
I've tried the script and a few PCM files with different headers wont work with it and only outputs the header made by the script. I've also included a adpcm file that distorts after the audio track plays.
EDIT: Added an unworking adpcm CPK.
https://app.box.com/s/wf5ye8p3g92ryiyp8kxl
Re: Rayman Legends PC Audio Container
Posted: Fri Aug 30, 2013 9:41 pm
by AlphaTwentyThree
Corrected the script for PCM files, also corrected the sample calculation for the GENH header and some variable offsets.
However:
The problem with the ADPCM file is that it's MS ADPCM mono, which isn't supported by GENH nor vgmstream. I'm quite at a loss here... If anyone can help I'd be thankful!
Re: Rayman Legends PC Audio Container
Posted: Fri Aug 30, 2013 10:19 pm
by !!!!!
AlphaTwentyThree wrote:Corrected the script for PCM files, also corrected the sample calculation for the GENH header and some variable offsets.
However:
The problem with the ADPCM file is that it's MS ADPCM mono, which isn't supported by GENH nor vgmstream. I'm quite at a loss here... If anyone can help I'd be thankful!
Thanks for the quick update, Alpha23. Is it possible for the single channel be copied as the second channel and then made as a pseudo 2ch mono ADPCM GENH temporarily until single channel GENH is supported?
Re: Rayman Legends PC Audio Container
Posted: Sat Aug 31, 2013 10:23 am
by AlphaTwentyThree
I'll ask snakemeat first.
Apart from that: I'm not even sure if ms_adpcm even supports mono. And I'm not sure if it's possible to create pseudo-stereo files, but we'll see.
Re: Rayman Legends PC Audio Container
Posted: Mon Sep 02, 2013 10:01 pm
by !!!!!
AlphaTwentyThree wrote:I'll ask snakemeat first.
Apart from that: I'm not even sure if ms_adpcm even supports mono. And I'm not sure if it's possible to create pseudo-stereo files, but we'll see.
Alpha23 do you have to use GENH headers on the ADPCM files because they are actually Microsoft WAV ADPCM files which if headers were applied, could solve the mono issue.
Re: Rayman Legends PC Audio Container
Posted: Mon Sep 02, 2013 11:02 pm
by AlphaTwentyThree
!!!!! wrote:AlphaTwentyThree wrote:I'll ask snakemeat first.
Apart from that: I'm not even sure if ms_adpcm even supports mono. And I'm not sure if it's possible to create pseudo-stereo files, but we'll see.
Alpha23 do you have to use GENH headers on the ADPCM files because they are actually Microsoft WAV ADPCM files which if headers were applied, could solve the mono issue.
Well, if somebody could tell me how to construct a valid msadpcm header...
Re: Rayman Legends PC Audio Container
Posted: Wed Sep 04, 2013 10:48 pm
by Savage
Is possible make a reverse way? convert wav to wav.cpk?
Re: Rayman Legends PC Audio Container
Posted: Wed Sep 02, 2015 6:49 am
by lonrot
AlphaTwentyThree please update the script to include sound effects as well!
I managed to extract most music, however with smaller sound effects the conversion returns this useless "filename.wav.ckd.genh" format, and renaming it does nothing.
Here are some original wav.ckd files that are not converting properly:
https://dl.dropboxusercontent.com/u/621 ... ds-sfx.zip
Thank you!
Re: Rayman Legends PC Audio Container
Posted: Wed Sep 02, 2015 10:26 am
by AlphaTwentyThree
As I said, I don't know how to construct a working MSADPCM mono header. The genh header is correct but for some reason vgmstream doesn't play the files.
As of now there's nothing I can do to solve the problem I'm afraid.