aboutsummaryrefslogtreecommitdiff
path: root/scale.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'scale.bqn')
-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βŠΈβ†“