module Csound.Air.Spec(
toSpec, fromSpec, mapSpec, scaleSpec, addSpec, scalePitch
) where
import Csound.Typed
import Csound.Typed.Opcode
toSpec :: Sig -> Spec
toSpec asig = pvsanal asig 1024 256 1024 1
fromSpec :: Spec -> Sig
fromSpec = pvsynth
mapSpec :: (Spec -> Spec) -> Sig -> Sig
mapSpec f = fromSpec . f . toSpec
scaleSpec :: Sig -> Sig -> Sig
scaleSpec k = mapSpec $ \x -> pvscale x k
addSpec :: Sig -> Sig -> Sig
addSpec hz = mapSpec $ \x -> pvshift x hz 0
scalePitch :: Sig -> Sig -> Sig
scalePitch n = scaleSpec (semitone n)