Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Rayman Legends PC Audio Container

Get help on any and all audio formats, or chip in and help others!
!!!!!
advanced
Posts: 40
Joined: Mon Jun 22, 2009 1:55 am
Has thanked: 25 times
Been thanked: 8 times

Rayman Legends PC Audio Container

Post 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:
Image

ADPCM:
Image
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post 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).
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
!!!!!
advanced
Posts: 40
Joined: Mon Jun 22, 2009 1:55 am
Has thanked: 25 times
Been thanked: 8 times

Re: Rayman Legends PC Audio Container

Post 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.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post by AlphaTwentyThree »

No XOR needed, PCM files are ok.
Need more ADPCM samples.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
!!!!!
advanced
Posts: 40
Joined: Mon Jun 22, 2009 1:55 am
Has thanked: 25 times
Been thanked: 8 times

Re: Rayman Legends PC Audio Container

Post by !!!!! »

AlphaTwentyThree wrote:No XOR needed, PCM files are ok.
Need more ADPCM samples.
Here's 5 more ADPCM samples

RL5adpcm
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post 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
Last edited by AlphaTwentyThree on Fri Aug 30, 2013 9:37 pm, edited 3 times in total.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
!!!!!
advanced
Posts: 40
Joined: Mon Jun 22, 2009 1:55 am
Has thanked: 25 times
Been thanked: 8 times

Re: Rayman Legends PC Audio Container

Post by !!!!! »

AlphaTwentyThree wrote:Ok, found the time to write the script. Had to implement the generic header first.
Try if this works:

Code: Select all

script
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
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post 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!
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
!!!!!
advanced
Posts: 40
Joined: Mon Jun 22, 2009 1:55 am
Has thanked: 25 times
Been thanked: 8 times

Re: Rayman Legends PC Audio Container

Post 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?
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post 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.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
!!!!!
advanced
Posts: 40
Joined: Mon Jun 22, 2009 1:55 am
Has thanked: 25 times
Been thanked: 8 times

Re: Rayman Legends PC Audio Container

Post 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.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post 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...
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
User avatar
Savage
VIP member
VIP member
Posts: 559
Joined: Sun Apr 17, 2005 11:00 am
Has thanked: 16 times
Been thanked: 18 times

Re: Rayman Legends PC Audio Container

Post by Savage »

Is possible make a reverse way? convert wav to wav.cpk?
Image
lonrot
ultra-n00b
Posts: 8
Joined: Wed Sep 02, 2015 6:38 am

Re: Rayman Legends PC Audio Container

Post 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!
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Rayman Legends PC Audio Container

Post 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.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
Post Reply