aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--options.bqn10
-rw-r--r--wav.bqn12
2 files changed, 12 insertions, 10 deletions
diff --git a/options.bqn b/options.bqn
new file mode 100644
index 0000000..a5d2066
--- /dev/null
+++ b/options.bqn
@@ -0,0 +1,10 @@
+FBytes ⇐ •FBytes
+fmt ⇐ 1‿16 # Format: 16-bit integer
+freq ⇐ 44100 # Frequency: 44.1kHz
+Set ⇐ {fmt‿freq↩𝕩}
+
+# For reading/writing wave files
+warn_dither ⇐ 0 # Whether to warn on non-integer signal
+warn_clip ⇐ 1 # Whether to warn on out-of-bounds signal
+Dither ⇐ ⌊ (0.5 + 0 -˝∘(•RAND∘⥊)˜ (2∾≢))⊸+
+Resample ⇐ "No resampling function specified"!0˙
diff --git a/wav.bqn b/wav.bqn
index 623959a..24e1a4a 100644
--- a/wav.bqn
+++ b/wav.bqn
@@ -3,16 +3,8 @@
⟨ReadWav, WriteWav, ReadWav_set, ReadWav_coerce⟩⇐
-o ← options ⇐ {
- FBytes ⇐ •FBytes
- fmt ⇐ 1‿16 # Format: 16-bit integer
- freq ⇐ 44100 # Frequency: 44.1kHz
- warn_dither ⇐ 0 # Whether to warn on non-integer signal
- warn_clip ⇐ 1 # Whether to warn on out-of-bounds signal
- Dither ⇐ ⌊ (0.5 + 0 -˝∘(•RAND∘⥊)˜ (2∾≢))⊸+
- Resample ⇐ "No resampling function specified"!0˙
- Set ⇐ {fmt‿freq↩𝕩}
-}
+"wav.bqn takes a single option namespace, or no arguments" ! 1≥≠•args
+o ← ≠◶⟨•Import∘"options.bqn", ⊑⟩ •args
# The output from ReadWav, or input to WriteWav, is either:
# - A list of: