From 7790114cf86916b6d187f9aeaa3be6f9cf78ce53 Mon Sep 17 00:00:00 2001 From: Valentin Ochs Date: Tue, 29 Dec 2020 12:03:08 +0100 Subject: [PATCH] Initial commit --- 01_start.ksy | 9 ++++ 02_preamble.ksy | 19 +++++++ 03_sections.ksy | 31 +++++++++++ 04_fmt.ksy | 50 ++++++++++++++++++ 05_data.ksy | 74 +++++++++++++++++++++++++++ 06_fact_peak.ksy | 90 ++++++++++++++++++++++++++++++++ 07_list.ksy | 110 ++++++++++++++++++++++++++++++++++++++++ README.md | 8 +++ wav_files/f32-mono.wav | Bin 0 -> 17832 bytes wav_files/s16-mono.wav | Bin 0 -> 8976 bytes wav_files/s8-stereo.wav | Bin 0 -> 8976 bytes 11 files changed, 391 insertions(+) create mode 100644 01_start.ksy create mode 100644 02_preamble.ksy create mode 100644 03_sections.ksy create mode 100644 04_fmt.ksy create mode 100644 05_data.ksy create mode 100644 06_fact_peak.ksy create mode 100644 07_list.ksy create mode 100644 README.md create mode 100644 wav_files/f32-mono.wav create mode 100644 wav_files/s16-mono.wav create mode 100644 wav_files/s8-stereo.wav 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 0000000000000000000000000000000000000000..e496d15f02ba1248600e9378807e95351c540936 GIT binary patch literal 17832 zcmeI)K}y3w6vpwdTEu0&L5~o-bW?&!WT=fL23<<5i7hl0>UbXy;KmbV>rr|P-{>ud z|Kh>CWD$q z{A`X-UDwU6sh7q#$4m-2!5Clw0~o+Sqy`47i(m{efB_6(AVvf8Nat?qVvmji3}65Q z1N%7ku^7Mr1~3q*0oFOJb1;Ab3}7Hu14E>9H+AuE0RtGo00!nZ#}SMH1~7mD48&+) zU?0bKcnn|w0~m{uQzt?i7SgcSEkD| zYx}L=wQ{Q}3t6*!{^;e>sy+|d!EfKa^}k;Jw)=y< Nsje2`+?C`~`US29O;`W` literal 0 HcmV?d00001 diff --git a/wav_files/s16-mono.wav b/wav_files/s16-mono.wav new file mode 100644 index 0000000000000000000000000000000000000000..9f6738d553531cfd8bcdb041faada3c47662c4dc GIT binary patch literal 8976 zcmaKy-EJI35QQfQpGhChF} zHoP;uKm7b~`EdE+FzhUL7Q5|-f4htM;>KcYacl9(;?wqXb1`ePyY2U0o7r1kxkAgW zX0_es7@xKEvCeUOHIw!8OD{XC^Vr5FzcZIn&+tPu#+VDv^24g$Ht~!ZG_y-wS)Xf= z&D(h*;;rIVMCal?|Mr^aTZ@kyBU{Y}>kE?@WHEk|n~a%PSPTOA?9YN*&N7e3o)e^6rZA z9d@)eQ@Bd?;BYE(47q7;n@q9cPPsii&)%bFJ-F~<}ZKG#x^t}C?b@MOAH{*+DceEPK%KSTNcC3!a zt38z$qUt-xqvr8NTX)=i5j9?djoEn2>{*KxT%e1MD>4%#XBVr^+F1}4-b4Xeu$!H6 z;x{=YJG_D)fD=}x9LiPZ;t9X-p9qyLT#%`&SYh68#(x^pmkkpm z@ff7}p&sizmLF@L4EidvI{dK3Vg5&4ozvJKI+m^v;L(y|5 zAF^!~PA_pK6Me@@4l>TQ93-k}lR=4rlV=NV{v$94BQ4};ON{)U9k2)(h zX5wFUQlm2yZ)&ot)$4!p#;7W2pTaA>1Z4KRo-6t?PYPEdPIx3l@Pg6hFfR`Mz=0?joeWLp3rk;CxiHOFH}Z$=9&X( z^$~kTbppGc`n##Q>MGhFT_|U(G`vSNKEdS@R< zr+7O)Z$If;C(XY1!Fu$pG&8Hq?tJCTF=CRXnkau~&427%trnVcK-w7St|rvqy;W%uccPA3aKU*J#wRD>#*CA03`Tp5*P+~(HJc0FVi;}bvtutU$lI;;Xxsz4e=Od zKo9lbt79n$2onzvD0*+})A@Ym6YPaG(Rjx&OOCzHt7`VYuaP;>vk_#F`aVr)iCyXHTZb z6RGN$Yj;eJc^6K^@QN>XQ0WjV%9FmDY=$Gu&&OfF8m|*`gmm(yixDuo-dR3 zP`eg8!|Zxn_?Ow>fz|3uH76e9dQ3E{Sv~0gIVK}LRCn`xHeW=2?!s&ElLHxKcdqYD zb~pJ3fpKJl-C57kXbZ}RDtd>aq-Y>d!0Y;$cMqTKQKVAB_>Bj(vsXtHD7qC5p_iaC zT=U)l8fSUKNY|R`CHT=1eg`YqMcpf3DW}=E3dCrZT{kLaX4Nr!_DbJml4v4uReD?A z4>Mj|lon?-v*=^tR4d^N-7L1emP`Ei-=483yS|ec-(xbPgApNK6PJ0%KvH9JV6Chl zp6nCwT{{Mz%1gXrV@-p!KX*rfDh$zc>@y;doxD#m$?|jsyRIse3KfGrUu9Fdfm{B~ z!FwsSPE_x|($xB1rH)67R6OtWQjusx=If4Tt}Ix)x9TqWa>!Zrrl@p%-&1wdC8De- zA4*yv2GSrYFLnx%q)Mr%`via1H}RNdozF@jfgL@{Y>xe|rAm%@U-Ub>_fzNV zNT{8hg?}yJy1xJU-S4<5OzCj1EvQ6wBh(UoNjKqdU;d3KD`PS3R=uW_W~hzM##4G` z`dD-UeT#B4nKI>@@h%H|{>#Hny$wFT;E;}cUW&W zyD970t9jcccln0t{@Eb0>Faf7h2_#dUT=xy$~@1BW*u(6+W+>!Z|(o2?BBop_5S_a z_ugyg%g4(nkB0qk4({aY;gcW#I2`tGA3V68t7pr{i)FL_?B447r{50`A3a^RYpmzn d^X)eK#r=b<{q@n)XU)@tgD>B0SKG5;_z(JYQlbC= literal 0 HcmV?d00001 diff --git a/wav_files/s8-stereo.wav b/wav_files/s8-stereo.wav new file mode 100644 index 0000000000000000000000000000000000000000..0ad8745b4d8710b682c0ce0489d20576813c3748 GIT binary patch literal 8976 zcma)?UyhVT6vaP{F+A|#5{zyD*#QwT69vsk)K^qg5(X1&pJyIjjJsn4cFo~8=iFQM z^-Mbb)xGE6t?s4@HJ+b6d2;XbZTsobk6-Q=QVRaCKS!OlSJ(-6$b* zTxW{W%o~bS_5EFI?_b@&T)eN2n3>a6_gmeW?8&!URX$UnwLPGBL57y8_=Mf1TkWf+ zWeT+>@&siC*E-NX#f;d_la$_5-^I+?nOVJNXI7KcmGtb?p8y1f*6gJ9Gdb#>!alsZ zs-DrAb0u6ovs3Go?tw{l&MKjayvPOWMqdB%<6>?^mzzH*=GS@dL%UhbMv zyOpXcYG-||M%Uj$jJuMz_ub$7m41aO9rsGXH-n}+K&x|&TH~sw316}LrKEPv99BC? zl9o<7)O|(8C!W*NVU=~sk6N#eiUDOReXuvTYCoHt-#DGue;aZaz^~4+u~e<n+CTKqu zg|lxT$*G==9@f)g_OanUbMy3&~d=hm=d4l(KIbT|Dxq@A&vxX1Tj(mGe( zjedWgnve-AkKMB#q-va!)pcFYD(99{8z=MTBv;IiiqEIM^6u(A;J>+yyE41yXRdCU zq3UlG9nZeHPIbd&epSu6R>`fNdlCI@xyj>U?GwPq%By18Wt~&%J~Jm({*AngtX$`u ztWhL(s+JyC?~Jdio}2EKUY|N$Rt?l$)?(fx?Vpx?BG+dZRCk0spKvAICC3?SHR*k| zI`1a$0KIkQj8*UKkuvpYSV=ggLA$pyg%zE9A>jHigPvG%cUI_IX0JnGF7=>b^j)95 zGy}03KkLj$KjS#Y+B1`b2V)ntr<1xrlQlP^`@6i2$?v3Szdifm`Jc!CC*|zflkd)+ zJ$m}_u|B*yyneZzeSiLVbT3~2^3TO~_UQciz0tiry!!ia)PMQ(y8rdBi;I_U4#!^V ghYub;II>?qJ0IRZUcPyIOnQF)%}2-X!57>1KR-iDr~m)} literal 0 HcmV?d00001