aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-12-11 21:54:08 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-12-11 21:54:08 -0500
commit5221259f777ff1abd83d0f0e806bc289ae860977 (patch)
treebba8523ad4818909e59076086a4fc4685808c8a4
parenta5a973ca00fd8ab399b168d085d1d1303c224a2f (diff)
Scale utilities
-rw-r--r--scale.bqn12
1 files changed, 12 insertions, 0 deletions
diff --git a/scale.bqn b/scale.bqn
new file mode 100644
index 0000000..b6eb24f
--- /dev/null
+++ b/scale.bqn
@@ -0,0 +1,12 @@
+# Utilities for working with notes and scales
+
+# A minor scale goes up two fifths and down four from the root
+minor ← ∧12|7Γ—2-↕7
+
+# Transpose frequency 𝕩 up 𝕨 semitones.
+Trans ⇐ (2 ⋆ ÷⟜12)βŠΈΓ—
+
+# Frequency from note in roughly scientific pitch notation
+# e.g. C#, A4, Gb2, F##
+Oct ← βŠ‘'4'-˜('0'βŠΈβ‰€βˆ§β‰€βŸœ'9')⊸/∾"3"Λ™ # Default to 3 to hit middle C
+Note ⇐ (minorβŠ‘Λœ'a'(⊒-≀◢'A'β€ΏβŠ£)βŠ‘) (+´⟜(-˝"#b"=⌜⊒) Trans 440Γ—2⋆Oct∘⊒) 1βŠΈβ†“