{"action":"opened","issue":{"url":"https://api.github.com/repos/haha01haha01/MapleLib/issues/2","labels_url":"https://api.github.com/repos/haha01haha01/MapleLib/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/haha01haha01/MapleLib/issues/2/comments","events_url":"https://api.github.com/repos/haha01haha01/MapleLib/issues/2/events","html_url":"https://github.com/haha01haha01/MapleLib/issues/2","id":100762083,"number":2,"title":"Sound property extract discussing","user":{"login":"Kagamia","id":10445904,"avatar_url":"https://avatars.githubusercontent.com/u/10445904?v=3","gravatar_id":"","url":"https://api.github.com/users/Kagamia","html_url":"https://github.com/Kagamia","followers_url":"https://api.github.com/users/Kagamia/followers","following_url":"https://api.github.com/users/Kagamia/following{/other_user}","gists_url":"https://api.github.com/users/Kagamia/gists{/gist_id}","starred_url":"https://api.github.com/users/Kagamia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kagamia/subscriptions","organizations_url":"https://api.github.com/users/Kagamia/orgs","repos_url":"https://api.github.com/users/Kagamia/repos","events_url":"https://api.github.com/users/Kagamia/events{/privacy}","received_events_url":"https://api.github.com/users/Kagamia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-13T12:53:54Z","updated_at":"2015-08-13T12:53:54Z","closed_at":null,"body":"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.\r\n\r\nShort of say, the header for MP3 format and WAV format have similar structure, only different in length.\r\n**MP3 header** (82 bytes)\r\n![header_mp3](https://cloud.githubusercontent.com/assets/10445904/9249026/ae30986c-41f3-11e5-8e32-8fc223680017.png)\r\n**WAV header** (70 bytes)\r\n![header_wav](https://cloud.githubusercontent.com/assets/10445904/9249027/afedc65c-41f3-11e5-87fd-fe84cb67cd03.png)\r\n\r\nthe header structure layout like this:\r\n```csharp\r\n// header start\r\n// first 51 byte is fixed\r\nbyte count1;  //count of guid1, always 2\r\nbyte[][] someGuid1 = new byte[count1][16]; \r\nbyte count2;  //always 0\r\nbyte[][] someGuid2; // never used\r\nbyte count3;  //count of guid3, always 1\r\nbyte[][] someGuid3 = new byte[count3][16]; \r\n\r\n// wave format \r\nbyte waveFormatLength;  //0x1e for mp3,  0x12 for wav\r\nWAVEFORMATEX waveFormatEx; //wave format declaration\r\n```\r\nGUID can find form ffmpeg source code \r\nGUID1 is similar to **mediasubtype_mpeg1payload** in [wtvdec.c](https://github.com/FFmpeg/FFmpeg/blob/189420cb561929e05f5cc4224cdca83740a24a32/libavformat/wtvdec.c)\r\nGUID3 is same as **ff_format_waveformatex** in [wtv_common.c](https://github.com/FFmpeg/FFmpeg/blob/7206b94fb893c63b187bcdfe26422b4e026a3ea0/libavformat/wtv_common.c)\r\nWAVEFORMATEX can find form **MMREG.H** (windows SDK)\r\nfor wav format:  [WAVEFORMATEX](https://msdn.microsoft.com/en-us/library/ms713497.aspx)\r\nfor mp3 format: [MPEGLAYER3WAVEFORMAT](https://msdn.microsoft.com/en-us/library/dd390710%28VS.85%29.aspx)\r\n\r\n**WAV header (encrypted)** (70 bytes)\r\n![header_wav_kmst](https://cloud.githubusercontent.com/assets/10445904/9250141/5b5a42dc-41fd-11e5-9bd6-c0eeed94a850.png)\r\n\r\nIn kmst, waveFormatEx is encrypt, we can use WZKEY decrypt the last 0x12 byte, it will be back. \r\n\r\nEverything make sense :smile: "}}