aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-11-08 21:55:20 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-11-08 21:55:20 -0500
commit1751cbbc57680fdbc005b47595db3e7780529921 (patch)
tree00fdaf9a0f9bfb04020d9a68b3a6565c3e649e67
parent2c83a39a88241571d7945a9ec4929fee95b570fc (diff)
Avoid relying on dzaima/BQN features in wav.bqn
-rw-r--r--wav.bqn7
1 files changed, 5 insertions, 2 deletions
diff --git a/wav.bqn b/wav.bqn
index cee527a..0355af2 100644
--- a/wav.bqn
+++ b/wav.bqn
@@ -55,6 +55,9 @@ wh ← {
# Then fill blank definitions with a self-reference
def ↩ ↕∘≠⊸({⊑‿𝕨⍟(0=≠)𝕩}¨) def
+
+ # Turn list of values into namespace
+ makeNS ⇐ •BQN "{"∾(1↓∾"‿"⊸∾¨name)∾"←𝕩}"
}
# Return an undoable (⁼) function to convert bytes to PCM data.
@@ -92,7 +95,7 @@ _audioConvert ← {
"Float formats other than 32-bit are not supported" ! 4=l
8‿23‿127 _float ·4 _int -⟜@ ;
𝕩:
- 0 !˜ "Unsupported audio format: " ∾ 2•Pretty audioFormat
+ 0 !˜ "Unsupported audio format: " ∾ •Repr audioFormat
}audioFormat
}
@@ -121,7 +124,7 @@ Decode ← {
# Assign field values to field names.
hdr ↩ ('i'=wh.typ) ToInt∘⊢⍟⊣¨ wh.len /⊸⊔ hdr
- •Eval(1↓∾"‿"⊸∾¨wh.name)∾"←hdr"
+ subchunk1Size‿subchunk2Size‿subchunk2ID‿audioFormat‿bitsPerSample‿sampleRate‿numChannels ← wh.MakeNS hdr
# Handle extensible format
"subchunk1Size is invalid" ! 0‿2‿24 ∊˜ se←subchunk1Size-16
If (se>0)‿{𝕤