module Synthesizer.SampleRateContext.Oscillator (
static,
freqMod,
phaseMod,
phaseFreqMod,
) where
import qualified Synthesizer.Plain.Oscillator as Osci
import qualified Synthesizer.Basic.Wave as Wave
import qualified Synthesizer.SampleRateContext.Signal as SigC
import qualified Synthesizer.SampleRateContext.Rate as Rate
import Synthesizer.SampleRateContext.Signal (toFrequencyScalar)
import qualified Algebra.OccasionallyScalar as OccScalar
import qualified Algebra.RealField as RealField
import qualified Algebra.Field as Field
import PreludeBase as P
static :: (RealField.C t, Field.C t', OccScalar.C t t') =>
Wave.T t yv
-> y'
-> t
-> t'
-> Rate.T t t'
-> SigC.T y y' yv
static wave amplitude phase freq' sr =
let freq = toFrequencyScalar sr freq'
in SigC.Cons amplitude (Osci.static wave phase freq)
freqMod :: (RealField.C t, Field.C t', OccScalar.C t t') =>
Wave.T t yv
-> y'
-> t
-> Rate.T t t'
-> SigC.T t t' t
-> SigC.T y y' yv
freqMod wave amplitude phase sr xs =
let freqs = SigC.scalarSamples (toFrequencyScalar sr) xs
in SigC.Cons amplitude
(Osci.freqMod wave phase freqs)
phaseMod :: (RealField.C t, Field.C t', OccScalar.C t t') =>
Wave.T t yv
-> y'
-> t'
-> Rate.T t t'
-> SigC.T t t t
-> SigC.T y y' yv
phaseMod wave amplitude freq' sr xs =
let freq = toFrequencyScalar sr freq'
phases = SigC.scalarSamples id xs
in SigC.Cons amplitude
(Osci.phaseMod wave freq phases)
phaseFreqMod :: (RealField.C t, Field.C t', OccScalar.C t t') =>
Wave.T t yv
-> y'
-> Rate.T t t'
-> SigC.T t t t
-> SigC.T t t' t
-> SigC.T y y' yv
phaseFreqMod wave amplitude sr xs ys =
let phases = SigC.scalarSamples id xs
freqs = SigC.scalarSamples (toFrequencyScalar sr) ys
in SigC.Cons amplitude
(Osci.phaseFreqMod wave phases freqs)