aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter.bqn7
-rw-r--r--oscillator.bqn4
-rw-r--r--panap.bqn4
3 files changed, 3 insertions, 12 deletions
diff --git a/filter.bqn b/filter.bqn
index 7f0751d..9c65071 100644
--- a/filter.bqn
+++ b/filter.bqn
@@ -32,6 +32,7 @@
"filter.bqn takes a single option namespace, or no arguments" ! 1≥≠•args
o ← ≠◶⟨•Import∘"options.bqn", ⊑⟩ •args
+Sin‿Cos‿Tan ← •math
# Generalized filtering
# 𝕩 is the signal to filter
@@ -60,12 +61,6 @@ _f ← { !∘0⊘(𝔽⊸Filter) }
# Compute the frequency response from coefficients
#Response ← ≍○<⟜(1∾-)○⌽´ ⊸ ((|·÷´{+⟜(𝕩⊸×)´𝕨}¨)⎉∞‿0) ⟜ (⋆0i1×Om)
-# Trig (approximations for now)
-SP ← (4⊸×÷5⊸-) 4׬⊸×
-Sin ← (⊢-∘⊢⍟(>⟜1)·SP 1⊸|) 2|÷⟜π
-Cos ← Sin (π÷2)⊸-
-Tan ← Sin ÷ Cos
-
Om ← (2×π)×{𝕩÷o.freq}
Tom ← Tan Om÷2˙
diff --git a/oscillator.bqn b/oscillator.bqn
index 3531a76..2713074 100644
--- a/oscillator.bqn
+++ b/oscillator.bqn
@@ -9,7 +9,6 @@ o ← ≠◶⟨•Import∘"options.bqn", ⊑⟩ •args
# Utilities
Ce ← 1-˜2⊸× # Center: transform [0,1] to [¯1,1]
-SP ← (4⊸×÷5⊸-) 4׬⊸× # Sine π×𝕩 by Bhaskara I
Rand ← Ce {o.RandFloats 𝕩}
# Basic waveforms
@@ -21,8 +20,7 @@ Saw ⇐ Ce∘P # Sawtooth wave //////
Triangle ⇐ Ce∘| {𝕨+0.25}Saw⊢ # Triangle wave ´\/\/\
Square⇐ Ce 0.5<P # Square wave ⊔¯⊔¯⊔¯
Pulse ⇐ Ce <⟜P # Pulse wave with duty cycle 𝕨
-#Sine ⇐ •Math.Sine (2×π) × Id # Sine wave
-Sine ⇐ (××SP∘|) {𝕨+0.5}Saw⊢ # Sine wave, more or less
+Sine ⇐ •math.Sin (2×π) × Id # Sine wave
# Random waveforms
White ⇐ Rand ≢ # White noise
diff --git a/panap.bqn b/panap.bqn
index 0817387..313ff72 100644
--- a/panap.bqn
+++ b/panap.bqn
@@ -2,9 +2,7 @@
o ← ≠◶⟨•Import∘"options.bqn", ⊑⟩ •args
mix‿fil ← •Import¨ "mix.bqn"‿"filter.bqn"
-SP ← (4⊸×÷5⊸-) 4׬⊸×
-Sin ← (⊢-∘⊢⍟(>⟜1)·SP 1⊸|) 2|÷⟜π
-Cos ← Sin (π÷2)⊸-
+⟨Cos⟩ ← •math
# The goal of stereo panning is to make sounds appear to come from
# different directions. A well-panned sound for music will have the