diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-03-11 19:09:56 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-03-11 19:09:56 -0500 |
| commit | 15a4f7e829a9fb70b6e5078b2c6ce73a5ade7c18 (patch) | |
| tree | 4f8ee5e24eadd0408f0de4a2c5d5234a97747799 | |
| parent | e0d4b50898a5f8ef41985d58d1bdc6a92c0b1b62 (diff) | |
Function to get note from frequency
| -rw-r--r-- | scale.bqn | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -10,3 +10,7 @@ Trans ⇐ (2 ⋆ ÷⟜12)⊸× # 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⊸↓ + +# Nearest note from frequency +names ← ('A'⊸+ ∾⟜(/⟜"#")¨ ⊒) /12⊸«⊸-minor +FromFreq ⇐ 12 ((names⊑˜|) ∾ '4'+⌊∘÷˜) 0.5 ⌊∘+ Trans⟜440⁼ |
