KMST client has extension WAVE format sounds in wz file for years, and encrypt sound header in latest client version(1018). I'm dealing with the hex numbers for hours and find the RIGHT way to read the header.
Short of say, the header for MP3 format and WAV format have similar structure, only different in length.
MP3 header (82 bytes)
![header_mp3](https://cloud.githubusercontent.com/assets/10445904/9249026/ae30986c-41f3-11e5-8e32-8fc223680017.png)
WAV header (70 bytes)
![header_wav](https://cloud.githubusercontent.com/assets/10445904/9249027/afedc65c-41f3-11e5-87fd-fe84cb67cd03.png)
the header structure layout like this:
// header start
// first 51 byte is fixed
byte count1; //count of guid1, always 2
byte[][] someGuid1 = new byte[count1][16];
byte count2; //always 0
byte[][] someGuid2; // never used
byte count3; //count of guid3, always 1
byte[][] someGuid3 = new byte[count3][16];
// wave format
byte waveFormatLength; //0x1e for mp3, 0x12 for wav
WAVEFORMATEX waveFormatEx; //wave format declaration
GUID can find form ffmpeg source code
GUID1 is similar to mediasubtype_mpeg1payload in wtvdec.c
GUID3 is same as ff_format_waveformatex in wtv_common.c
WAVEFORMATEX can find form MMREG.H (windows SDK)
for wav format: WAVEFORMATEX
for mp3 format: MPEGLAYER3WAVEFORMAT
WAV header (encrypted) (70 bytes)
![header_wav_kmst](https://cloud.githubusercontent.com/assets/10445904/9250141/5b5a42dc-41fd-11e5-9bd6-c0eeed94a850.png)
In kmst, waveFormatEx is encrypt, we can use WZKEY decrypt the last 0x12 byte, it will be back.
Everything make sense ๐