commit 7790114cf86916b6d187f9aeaa3be6f9cf78ce53 Author: Valentin Ochs Date: Tue Dec 29 12:03:08 2020 +0100 Initial commit diff --git a/01_start.ksy b/01_start.ksy new file mode 100644 index 0000000..c59ade2 --- /dev/null +++ b/01_start.ksy @@ -0,0 +1,9 @@ +meta: + id: wav + file-extension: wav +seq: {} +instances: {} +types: {} +enums: {} +doc: Hello, world +doc-ref: https://example.com diff --git a/02_preamble.ksy b/02_preamble.ksy new file mode 100644 index 0000000..cc697bc --- /dev/null +++ b/02_preamble.ksy @@ -0,0 +1,19 @@ +meta: + id: wav + file-extension: wav + encoding: ascii + endian: le +seq: + - id: magic + type: str + size: 4 + - id: size + type: u4 + - id: wave_str + type: str + size: 4 +instances: {} +types: {} +enums: {} +doc: Hello, world +doc-ref: https://example.com diff --git a/03_sections.ksy b/03_sections.ksy new file mode 100644 index 0000000..a00a422 --- /dev/null +++ b/03_sections.ksy @@ -0,0 +1,31 @@ +meta: + id: wav + file-extension: wav + encoding: ascii + endian: le +seq: + - id: magic + type: str + size: 4 + - id: size + type: u4 + - id: wave_str + type: str + 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 +enums: {} +doc: Hello, world +doc-ref: https://example.com diff --git a/04_fmt.ksy b/04_fmt.ksy new file mode 100644 index 0000000..5a8ed83 --- /dev/null +++ b/04_fmt.ksy @@ -0,0 +1,50 @@ +meta: + id: wav + file-extension: wav + encoding: ascii + endian: le +seq: + - id: magic + type: str + size: 4 + - id: size + type: u4 + - id: wave_str + type: str + 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 + fmt: + seq: + - id: type + type: u2 + - 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 +enums: {} +doc: Hello, world +doc-ref: https://example.com diff --git a/05_data.ksy b/05_data.ksy new file mode 100644 index 0000000..a778444 --- /dev/null +++ b/05_data.ksy @@ -0,0 +1,74 @@ +meta: + id: wav + file-extension: wav + encoding: ascii + endian: le +seq: + - id: magic + type: str + size: 4 + - id: size + type: u4 + - id: wave_str + type: str + 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 + fmt: + seq: + - id: type + type: u2 + - 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 + instances: + combined_type: + value: type * 100 + bits_per_unit + data: + seq: + - id: content + type: sample + repeat: eos + types: + sample: + seq: + - id: data + type: + switch-on: _root.sections[0].content.\ + as.combined_type + cases: + 332: f4 + 108: u1 + 116: s2 + 132: s4 + repeat: expr + repeat-expr: _root.sections[0].content.\ + as.channels +enums: {} +doc: Hello, world +doc-ref: https://example.com diff --git a/06_fact_peak.ksy b/06_fact_peak.ksy new file mode 100644 index 0000000..9eb52f1 --- /dev/null +++ b/06_fact_peak.ksy @@ -0,0 +1,90 @@ +meta: + id: wav + file-extension: wav + encoding: ascii + endian: le +seq: + - id: magic + type: str + size: 4 + - id: size + type: u4 + - id: wave_str + type: str + 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 + fmt: + seq: + - id: type + type: u2 + - 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 + instances: + combined_type: + value: type * 100 + bits_per_unit + data: + seq: + - id: content + type: sample + repeat: eos + types: + sample: + seq: + - id: data + type: + switch-on: _root.sections[0].content.\ + as.combined_type + cases: + 332: f4 + 108: u1 + 116: s2 + 132: s4 + repeat: expr + repeat-expr: _root.sections[0].content.\ + as.channels + 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 +enums: {} +doc: Hello, world +doc-ref: https://example.com diff --git a/07_list.ksy b/07_list.ksy new file mode 100644 index 0000000..c21da0f --- /dev/null +++ b/07_list.ksy @@ -0,0 +1,110 @@ +meta: + id: wav + file-extension: wav + encoding: ascii + endian: le +seq: + - id: magic + type: str + size: 4 + - id: size + type: u4 + - id: wave_str + type: str + 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 + - 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 + instances: + combined_type: + value: type * 100 + bits_per_unit + data: + seq: + - id: content + type: sample + repeat: eos + types: + sample: + seq: + - id: data + type: + switch-on: _root.sections[0].content.\ + as.combined_type + cases: + 332: f4 + 108: u1 + 116: s2 + 132: s4 + repeat: expr + repeat-expr: _root.sections[0].content.\ + as.channels + 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: str + size: size +enums: {} +doc: Hello, world +doc-ref: https://example.com \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c637cf6 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Kaitai Struct Workshop + +## Links: + +- [kaitai.io](https://kaitai.io) +- [User Guide](https://doc.kaitai.io/user_guide.html) +- [Quick Start](https://kaitai.io/#quick-start) +- [Tutorial video](https://vimeo.com/495432528) diff --git a/wav_files/f32-mono.wav b/wav_files/f32-mono.wav new file mode 100644 index 0000000..e496d15 Binary files /dev/null and b/wav_files/f32-mono.wav differ diff --git a/wav_files/s16-mono.wav b/wav_files/s16-mono.wav new file mode 100644 index 0000000..9f6738d Binary files /dev/null and b/wav_files/s16-mono.wav differ diff --git a/wav_files/s8-stereo.wav b/wav_files/s8-stereo.wav new file mode 100644 index 0000000..0ad8745 Binary files /dev/null and b/wav_files/s8-stereo.wav differ