aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-11-22 19:29:10 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-11-22 19:29:10 -0500
commitae27931f4f5ce843cb0bc95925ee4630db94b33b (patch)
treeafe78117f1238cbc434d418f931725eebb443ef5
parentad2b018956a25d3733f7581556d56658a1a51f77 (diff)
Fix .wav file reading
-rw-r--r--wav.bqn4
1 files changed, 2 insertions, 2 deletions
diff --git a/wav.bqn b/wav.bqn
index 0355af2..173d77e 100644
--- a/wav.bqn
+++ b/wav.bqn
@@ -57,7 +57,7 @@ wh ← {
def ↩ ↕∘≠⊸({⊑‿𝕨⍟(0=≠)𝕩}¨) def
# Turn list of values into namespace
- makeNS ⇐ •BQN "{"∾(1↓∾"‿"⊸∾¨name)∾"←𝕩}"
+ makeNS ⇐ •BQN "{"∾(1↓∾"‿"⊸∾¨name)∾"⇐𝕩}"
}
# Return an undoable (⁼) function to convert bytes to PCM data.
@@ -126,7 +126,7 @@ Decode ← {
hdr ↩ ('i'=wh.typ) ToInt∘⊢⍟⊣¨ wh.len /⊸⊔ hdr
subchunk1Size‿subchunk2Size‿subchunk2ID‿audioFormat‿bitsPerSample‿sampleRate‿numChannels ← wh.MakeNS hdr
# Handle extensible format
- "subchunk1Size is invalid" ! 0‿2‿24 ∊˜ se←subchunk1Size-16
+ "subchunk1Size is invalid" ! ⊑ 0‿2‿24 ∊˜ se←subchunk1Size-16
If (se>0)‿{𝕤
! se = 2 + ToInt 2↑subchunk2ID
ext←@ ⋄ ext‿dat ↩ se (↑ ≍○< ↓) dat