Skip to content

Commit 5a799da

Browse files
authored
Merge pull request #5 from WolvenKit/feature/wem-format
Add basic Kaitai definition for WEM files
2 parents a147eca + 4747e23 commit 5a799da

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

ksy/wem.ksy

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
meta:
2+
id: wem
3+
file-extension: wem
4+
endian: le
5+
6+
seq:
7+
- id: riff_header
8+
type: riff_header
9+
- id: chunks
10+
type: chunk
11+
repeat: eos
12+
13+
types:
14+
riff_header:
15+
seq:
16+
- id: magic
17+
contents: 'RIFF'
18+
- id: chunk_size
19+
type: u4
20+
- id: wav_id
21+
type: u4
22+
riff_chunk:
23+
seq:
24+
- id: type
25+
# No longer using a string because the type can have some non-standard chars
26+
#type: str
27+
size: 4
28+
#encoding: UTF-8
29+
- id: size
30+
type: u4
31+
fmt_chunk:
32+
seq:
33+
- id: format_tag
34+
type: u2
35+
- id: channels
36+
type: u2
37+
- id: samples_per_sec
38+
type: u4
39+
- id: avg_bytes_per_sec
40+
type: u4
41+
- id: blockalign
42+
type: u2
43+
- id: bits_per_sample
44+
type: u2
45+
- id: size
46+
type: u2
47+
- id: valid_bits_per_sample
48+
type: u2
49+
- id: channel_mask
50+
type: u4
51+
- id: guid
52+
type: str
53+
size: 42
54+
encoding: utf-8
55+
cue_chunk:
56+
seq:
57+
- id: cue_count
58+
type: u4
59+
list_chunk:
60+
params:
61+
- id: size
62+
type: u4
63+
seq:
64+
- id: list
65+
size: size
66+
junk_chunk:
67+
seq:
68+
- id: junk
69+
type: str
70+
size: 26
71+
encoding: utf-8
72+
data_chunk:
73+
params:
74+
- id: size
75+
type: u4
76+
seq:
77+
- id: data
78+
type: str
79+
size: size
80+
encoding: utf-8
81+
chunk:
82+
seq:
83+
- id: riff_chunk
84+
type: riff_chunk
85+
- id: data
86+
type:
87+
switch-on: riff_chunk.type
88+
cases:
89+
'[0x66, 0x6d, 0x74, 0x20]': fmt_chunk
90+
'[0x4a, 0x55, 0x4e, 0x4b]': junk_chunk
91+
'[0x63, 0x75, 0x65, 0x20]': cue_chunk
92+
'[0x4c, 0x49, 0x53, 0x54]': list_chunk(riff_chunk.size)
93+
'[0x64, 0x61, 0x74, 0x61]': data_chunk(riff_chunk.size)

0 commit comments

Comments
 (0)