diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-02-05 22:09:27 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-02-06 08:04:46 -0500 |
| commit | ef11577d9451ba3fc01444cb373a4647d0451d17 (patch) | |
| tree | 92426a6bd5c902ac11fcbad9b3450c7d83bc31f6 | |
| parent | 814b56cd148846cde0d7ac62f702ead11c7d1d67 (diff) | |
Faster/cleaner pink noise generator code
| -rw-r--r-- | oscillator.bqn | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/oscillator.bqn b/oscillator.bqn index 2713074..e918072 100644 --- a/oscillator.bqn +++ b/oscillator.bqn @@ -27,7 +27,7 @@ White ⇐ Rand ≢ # White noise Brown ⇐ +` White # Brown noise # Pink noise #Pink ⇐ ÷⟜(⌈´|) (2⊸/⊸+˜´∘⌽ · Rand¨ 2⋆↕)⊸÷∘(1+·⌈2⋆⁼⊢)⊸(↑˜)∘≠ -Pink ⇐ ÷⟜(⌈´|) (+` ·⥊∘⍉∘≍´ ·-⟜«∘Rand¨ 2⋆1⌈⌽∘↕)∘(1+·⌈2⋆⁼⊢)⊸(↑˜)∘≠ +Pink ⇐ {÷⟜(⌈´|) +` 𝕩 ↑ ⥊∘⍉∘≍´⌽ -⟜«∘Rand¨ (1⌈↕∘⌈)⌾(2⋆⁼⊢)2⌈𝕩}∘≠ # Karplus-Stong algorithm for a plucked string Pluck ⇐ { 𝕊 f‿len‿att: # Frequency, length, attenuation |
