module Csound.Air.Pan(
HeadPanSpec(..),
headPan, headPan', staticHeadPan,
headPan2, headPan2', staticHeadPan2,
headPanNet, headPanNet2
) where
import Csound.Typed
import Csound.Air.Wav(toMono)
headPan2 :: (Sig, Sig) -> Sig2 -> Sig2
headPan2 :: (Sig, Sig) -> (Sig, Sig) -> (Sig, Sig)
headPan2 (Sig, Sig)
point = (Sig, Sig) -> Sig -> (Sig, Sig)
headPan (Sig, Sig)
point (Sig -> (Sig, Sig))
-> ((Sig, Sig) -> Sig) -> (Sig, Sig) -> (Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sig, Sig) -> Sig
toMono
headPan2' :: HeadPanSpec -> (Sig, Sig) -> Sig2 -> Sig2
headPan2' :: HeadPanSpec -> (Sig, Sig) -> (Sig, Sig) -> (Sig, Sig)
headPan2' HeadPanSpec
spec (Sig, Sig)
point = HeadPanSpec -> (Sig, Sig) -> Sig -> (Sig, Sig)
headPan' HeadPanSpec
spec (Sig, Sig)
point (Sig -> (Sig, Sig))
-> ((Sig, Sig) -> Sig) -> (Sig, Sig) -> (Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sig, Sig) -> Sig
toMono
staticHeadPan2 :: (D, D) -> Sig2 -> Sig2
staticHeadPan2 :: (D, D) -> (Sig, Sig) -> (Sig, Sig)
staticHeadPan2 (D, D)
point = (D, D) -> Sig -> (Sig, Sig)
staticHeadPan (D, D)
point (Sig -> (Sig, Sig))
-> ((Sig, Sig) -> Sig) -> (Sig, Sig) -> (Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sig, Sig) -> Sig
toMono
headPanNet :: (Int, Int) -> [Sig] -> Sig2
headPanNet :: (Int, Int) -> [Sig] -> (Sig, Sig)
headPanNet (Int
m, Int
n) [Sig]
sigs = [(Sig, Sig)] -> (Sig, Sig)
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum ([(Sig, Sig)] -> (Sig, Sig)) -> [(Sig, Sig)] -> (Sig, Sig)
forall a b. (a -> b) -> a -> b
$ ((D, D) -> Sig -> (Sig, Sig)) -> [(D, D)] -> [Sig] -> [(Sig, Sig)]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (D, D) -> Sig -> (Sig, Sig)
staticHeadPan [(Double -> D
double Double
a, Double -> D
double Double
b) | Double
a <- Int -> [Double]
forall b a. (Fractional b, Integral a) => a -> [b]
xs Int
m, Double
b <- Int -> [Double]
forall b a. (Fractional b, Integral a) => a -> [b]
xs Int
n] [Sig]
sigs
where xs :: a -> [b]
xs a
t = (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (( b -> b -> b
forall a. Fractional a => a -> a -> a
/ a -> b
forall a b. (Integral a, Num b) => a -> b
fromIntegral a
t) (b -> b) -> (a -> b) -> a -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
forall a b. (Integral a, Num b) => a -> b
fromIntegral) [a
0 .. (a
t a -> a -> a
forall a. Num a => a -> a -> a
- a
1)]
headPanNet2 :: (Int, Int) -> [Sig2] -> Sig2
headPanNet2 :: (Int, Int) -> [(Sig, Sig)] -> (Sig, Sig)
headPanNet2 (Int
m, Int
n) [(Sig, Sig)]
sigs = (Int, Int) -> [Sig] -> (Sig, Sig)
headPanNet (Int
m, Int
n) (((Sig, Sig) -> Sig) -> [(Sig, Sig)] -> [Sig]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig) -> Sig
toMono [(Sig, Sig)]
sigs)