136 lines
2.8 KiB
Plaintext
136 lines
2.8 KiB
Plaintext
meta:
|
|
id: wav
|
|
file-extension: wav
|
|
encoding: ascii
|
|
endian: le
|
|
seq:
|
|
- id: magic
|
|
contents: "RIFF"
|
|
size: 4
|
|
- id: size
|
|
type: u4
|
|
- id: wave_str
|
|
contents: "WAVE"
|
|
size: 4
|
|
- id: sections
|
|
type: section
|
|
repeat: eos
|
|
instances: {}
|
|
types:
|
|
section:
|
|
seq:
|
|
- id: name
|
|
type: str
|
|
size: 4
|
|
- id: size
|
|
type: u4
|
|
- id: content
|
|
size: size
|
|
type:
|
|
switch-on: name
|
|
cases:
|
|
'"fmt "': fmt
|
|
'"data"': data
|
|
'"fact"': fact
|
|
'"PEAK"': peak
|
|
'"LIST"': list
|
|
fmt:
|
|
seq:
|
|
- id: type
|
|
type: u2
|
|
enum: encoding_type_enum
|
|
- id: channels
|
|
type: u2
|
|
- id: samplerate
|
|
type: u4
|
|
- id: datarate
|
|
type: u4
|
|
doc: Might also be datarate per channel
|
|
- id: bytes_per_sample
|
|
type: u2
|
|
- id: bits_per_unit
|
|
type: u2
|
|
data:
|
|
seq:
|
|
- id: content
|
|
type:
|
|
switch-on: _root.sections[0].name
|
|
cases:
|
|
'"fmt "': sample(_root.sections[0].content.as<fmt>.type, _root.sections[0].content.as<fmt>.bits_per_unit)
|
|
_: u1
|
|
repeat: eos
|
|
types:
|
|
sample:
|
|
params:
|
|
- id: encoding_type
|
|
type: u2
|
|
enum: encoding_type_enum
|
|
- id: encoding_size
|
|
type: u2
|
|
seq:
|
|
- id: data
|
|
type:
|
|
switch-on: encoding_type
|
|
cases:
|
|
'encoding_type_enum::float': float_type
|
|
'encoding_type_enum::int': int_type
|
|
repeat: expr
|
|
repeat-expr: _root.sections[0].content.\
|
|
as<fmt>.channels
|
|
types:
|
|
float_type:
|
|
seq:
|
|
- id: data
|
|
type:
|
|
switch-on: _parent.encoding_size
|
|
cases:
|
|
32: f4
|
|
64: f8
|
|
int_type:
|
|
seq:
|
|
- id: data
|
|
type:
|
|
switch-on: _parent.encoding_size
|
|
cases:
|
|
8: u1
|
|
16: s2
|
|
32: s4
|
|
fact:
|
|
seq:
|
|
- id: samples
|
|
type: u4
|
|
peak:
|
|
seq:
|
|
- id: unknown_0
|
|
type: u4
|
|
- id: timestamp
|
|
type: u4
|
|
- id: peak
|
|
type: f4
|
|
- id: index
|
|
type: u4
|
|
list:
|
|
seq:
|
|
- id: info_str
|
|
type: str
|
|
size: 4
|
|
- id: contents
|
|
repeat: eos
|
|
type: content
|
|
types:
|
|
content:
|
|
seq:
|
|
- id: name
|
|
type: str
|
|
size: 4
|
|
- id: size
|
|
type: u4
|
|
- id: content
|
|
type: strz
|
|
size: size
|
|
enums:
|
|
encoding_type_enum:
|
|
1: 'int'
|
|
3: 'float'
|
|
doc: Hello, world
|
|
doc-ref: https://example.com |