From ef11577d9451ba3fc01444cb373a4647d0451d17 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 5 Feb 2022 22:09:27 -0500 Subject: Faster/cleaner pink noise generator code --- oscillator.bqn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3