module Sound.Sc3.Ugen.Hs where
import Data.List
import qualified System.Random as R
import Sound.Sc3.Common.Base
import Sound.Sc3.Common.Math
import qualified Sound.Sc3.Common.Math.Filter as Filter
type F_ST0 st o = st -> (o,st)
type F_ST1 st i o = (i,st) -> (o,st)
type F_U2 n = n -> n -> n
type F_U3 n = n -> n -> n -> n
type F_U4 n = n -> n -> n -> n -> n
type F_U5 n = n -> n -> n -> n -> n -> n
type F_U6 n = n -> n -> n -> n -> n -> n -> n
type F_U7 n = n -> n -> n -> n -> n -> n -> n -> n
type F_U8 n = n -> n -> n -> n -> n -> n -> n -> n -> n
type F_U9 n = n -> n -> n -> n -> n -> n -> n -> n -> n -> n
type T5 n = (n,n,n,n,n)
type T6 n = (n,n,n,n,n,n)
type T7 n = (n,n,n,n,n,n,n)
type T8 n = (n,n,n,n,n,n,n,n)
type T9 n = (n,n,n,n,n,n,n,n,n)
avg2 :: Fractional n => F_U2 n
avg2 :: forall n. Fractional n => F_U2 n
avg2 n
p n
q = (n
p forall a. Num a => a -> a -> a
+ n
q) forall n. Fractional n => F_U2 n
/ n
2
avg3 :: Fractional n => F_U3 n
avg3 :: forall n. Fractional n => F_U3 n
avg3 n
p n
q n
r = (n
p forall a. Num a => a -> a -> a
+ n
q forall a. Num a => a -> a -> a
+ n
r) forall n. Fractional n => F_U2 n
/ n
3
avg4 :: Fractional n => F_U4 n
avg4 :: forall n. Fractional n => F_U4 n
avg4 n
p n
q n
r n
s = (n
p forall a. Num a => a -> a -> a
+ n
q forall a. Num a => a -> a -> a
+ n
r forall a. Num a => a -> a -> a
+ n
s) forall n. Fractional n => F_U2 n
/ n
4
avg5 :: Fractional n => F_U5 n
avg5 :: forall n. Fractional n => F_U5 n
avg5 n
p n
q n
r n
s n
t = (n
p forall a. Num a => a -> a -> a
+ n
q forall a. Num a => a -> a -> a
+ n
r forall a. Num a => a -> a -> a
+ n
s forall a. Num a => a -> a -> a
+ n
t) forall n. Fractional n => F_U2 n
/ n
5
avg9 :: Fractional n => F_U9 n
avg9 :: forall n. Fractional n => F_U9 n
avg9 n
p n
q n
r n
s n
t n
u n
v n
w n
x = (n
p forall a. Num a => a -> a -> a
+ n
q forall a. Num a => a -> a -> a
+ n
r forall a. Num a => a -> a -> a
+ n
s forall a. Num a => a -> a -> a
+ n
t forall a. Num a => a -> a -> a
+ n
u forall a. Num a => a -> a -> a
+ n
v forall a. Num a => a -> a -> a
+ n
w forall a. Num a => a -> a -> a
+ n
x) forall n. Fractional n => F_U2 n
/ n
9
fir1 :: F_U2 n -> F_ST1 n n n
fir1 :: forall n. F_U2 n -> F_ST1 n n n
fir1 F_U2 n
f (n
n,n
z0) = (F_U2 n
f n
n n
z0,n
n)
fir2 :: F_U3 n -> F_ST1 (T2 n) n n
fir2 :: forall n. F_U3 n -> F_ST1 (T2 n) n n
fir2 F_U3 n
f (n
n,(n
z1,n
z0)) = (F_U3 n
f n
n n
z0 n
z1,(n
z0,n
n))
fir3 :: F_U4 n -> F_ST1 (T3 n) n n
fir3 :: forall n. F_U4 n -> F_ST1 (T3 n) n n
fir3 F_U4 n
f (n
n,(n
z2,n
z1,n
z0)) = (F_U4 n
f n
n n
z0 n
z1 n
z2,(n
z1,n
z0,n
n))
fir4 :: F_U5 n -> F_ST1 (T4 n) n n
fir4 :: forall n. F_U5 n -> F_ST1 (T4 n) n n
fir4 F_U5 n
f (n
n,(n
z3,n
z2,n
z1,n
z0)) = (F_U5 n
f n
n n
z0 n
z1 n
z2 n
z3,(n
z2,n
z1,n
z0,n
n))
fir8 :: F_U9 n -> F_ST1 (T8 n) n n
fir8 :: forall n. F_U9 n -> F_ST1 (T8 n) n n
fir8 F_U9 n
f (n
n,(n
z7,n
z6,n
z5,n
z4,n
z3,n
z2,n
z1,n
z0)) = (F_U9 n
f n
n n
z0 n
z1 n
z2 n
z3 n
z4 n
z5 n
z6 n
z7,(n
z6,n
z5,n
z4,n
z4,n
z2,n
z1,n
z0,n
n))
iir1 :: F_U2 n -> F_ST1 n n n
iir1 :: forall n. F_U2 n -> F_ST1 n n n
iir1 F_U2 n
f (n
n,n
y0) = let r :: n
r = F_U2 n
f n
n n
y0 in (n
r,n
r)
iir2 :: F_U3 n -> F_ST1 (T2 n) n n
iir2 :: forall n. F_U3 n -> F_ST1 (T2 n) n n
iir2 F_U3 n
f (n
n,(n
y1,n
y0)) = let r :: n
r = F_U3 n
f n
n n
y0 n
y1 in (n
r,(n
y0,n
r))
iir2_ff_fb :: (n -> n -> n -> T2 n) -> F_ST1 (T2 n) n n
iir2_ff_fb :: forall n. (n -> n -> n -> T2 n) -> F_ST1 (T2 n) n n
iir2_ff_fb n -> n -> n -> T2 n
f (n
n,(n
y1,n
y0)) = let (n
r,n
y0') = n -> n -> n -> T2 n
f n
n n
y0 n
y1 in (n
r,(n
y0,n
y0'))
biquad :: F_U5 n -> F_ST1 (T4 n) n n
biquad :: forall n. F_U5 n -> F_ST1 (T4 n) n n
biquad F_U5 n
f (n
n,(n
x1,n
x0,n
y1,n
y0)) = let r :: n
r = F_U5 n
f n
n n
x0 n
x1 n
y0 n
y1 in (n
r,(n
x0,n
n,n
y0,n
r))
sos_f :: Num n => T5 n -> F_U5 n
sos_f :: forall n. Num n => T5 n -> F_U5 n
sos_f (n
a0,n
a1,n
a2,n
b1,n
b2) n
x n
x1 n
x2 n
y1 n
y2 = n
a0forall a. Num a => a -> a -> a
*n
x forall a. Num a => a -> a -> a
+ n
a1forall a. Num a => a -> a -> a
*n
x1 forall a. Num a => a -> a -> a
+ n
a2forall a. Num a => a -> a -> a
*n
x2 forall a. Num a => a -> a -> a
- n
b1forall a. Num a => a -> a -> a
*n
y1 forall a. Num a => a -> a -> a
- n
b2forall a. Num a => a -> a -> a
*n
y2
sos :: Num n => T5 n -> F_ST1 (T4 n) n n
sos :: forall n. Num n => T5 n -> F_ST1 (T4 n) n n
sos T5 n
p = forall n. F_U5 n -> F_ST1 (T4 n) n n
biquad (forall n. Num n => T5 n -> F_U5 n
sos_f T5 n
p)
hpz1 :: Fractional n => F_ST1 n n n
hpz1 :: forall n. Fractional n => F_ST1 n n n
hpz1 = forall n. F_U2 n -> F_ST1 n n n
fir1 (\n
n n
z0 -> n
0.5 forall a. Num a => a -> a -> a
* (n
n forall a. Num a => a -> a -> a
- n
z0))
hpz2 :: Fractional n => F_ST1 (T2 n) n n
hpz2 :: forall n. Fractional n => F_ST1 (T2 n) n n
hpz2 = forall n. F_U3 n -> F_ST1 (T2 n) n n
fir2 (\n
n n
z0 n
z1 -> n
0.25 forall a. Num a => a -> a -> a
* (n
n forall a. Num a => a -> a -> a
- (n
2 forall a. Num a => a -> a -> a
* n
z0) forall a. Num a => a -> a -> a
+ n
z1))
lpz1 :: Fractional n => F_ST1 n n n
lpz1 :: forall n. Fractional n => F_ST1 n n n
lpz1 = forall n. F_U2 n -> F_ST1 n n n
fir1 forall n. Fractional n => F_U2 n
avg2
lpz2 :: Fractional n => F_ST1 (T2 n) n n
lpz2 :: forall n. Fractional n => F_ST1 (T2 n) n n
lpz2 = forall n. F_U3 n -> F_ST1 (T2 n) n n
fir2 (\n
n n
z0 n
z1 -> n
0.25 forall a. Num a => a -> a -> a
* (n
n forall a. Num a => a -> a -> a
+ (n
2 forall a. Num a => a -> a -> a
* n
z0) forall a. Num a => a -> a -> a
+ n
z1))
bpz2 :: Fractional n => F_ST1 (T2 n) n n
bpz2 :: forall n. Fractional n => F_ST1 (T2 n) n n
bpz2 = forall n. F_U3 n -> F_ST1 (T2 n) n n
fir2 (\n
n n
_z0 n
z1 -> n
0.5 forall a. Num a => a -> a -> a
* (n
n forall a. Num a => a -> a -> a
- n
z1))
brz2 :: Fractional n => F_ST1 (T2 n) n n
brz2 :: forall n. Fractional n => F_ST1 (T2 n) n n
brz2 = forall n. F_U3 n -> F_ST1 (T2 n) n n
fir2 (\n
n n
_z0 n
z1 -> n
0.5 forall a. Num a => a -> a -> a
* (n
n forall a. Num a => a -> a -> a
+ n
z1))
mavg5 :: Fractional n => F_ST1 (T4 n) n n
mavg5 :: forall n. Fractional n => F_ST1 (T4 n) n n
mavg5 = forall n. F_U5 n -> F_ST1 (T4 n) n n
fir4 forall n. Fractional n => F_U5 n
avg5
mavg9 :: Fractional n => F_ST1 (T8 n) n n
mavg9 :: forall n. Fractional n => F_ST1 (T8 n) n n
mavg9 = forall n. F_U9 n -> F_ST1 (T8 n) n n
fir8 forall n. Fractional n => F_U9 n
avg9
sr_to_rps :: Floating n => n -> n
sr_to_rps :: forall n. Floating n => n -> n
sr_to_rps n
sr = forall n. Floating n => n
two_pi forall n. Fractional n => F_U2 n
/ n
sr
resonz_f :: Floating n => T3 n -> (n -> n -> n -> T2 n)
resonz_f :: forall n. Floating n => T3 n -> n -> n -> n -> T2 n
resonz_f T3 n
param n
x n
y1 n
y2 =
let (n
a0,n
b1,n
b2) = forall n. Floating n => (n, n, n) -> (n, n, n)
Filter.resonz_coef T3 n
param
y0 :: n
y0 = n
x forall a. Num a => a -> a -> a
+ n
b1 forall a. Num a => a -> a -> a
* n
y1 forall a. Num a => a -> a -> a
+ n
b2 forall a. Num a => a -> a -> a
* n
y2
in (n
a0 forall a. Num a => a -> a -> a
* (n
y0 forall a. Num a => a -> a -> a
- n
y2),n
y0)
resonz_ir :: Floating n => T3 n -> F_ST1 (T2 n) n n
resonz_ir :: forall n. Floating n => T3 n -> F_ST1 (T2 n) n n
resonz_ir T3 n
p = forall n. (n -> n -> n -> T2 n) -> F_ST1 (T2 n) n n
iir2_ff_fb (forall n. Floating n => T3 n -> n -> n -> n -> T2 n
resonz_f T3 n
p)
rlpf_f :: Floating n => (n -> n -> n) -> T3 n -> F_U3 n
rlpf_f :: forall n. Floating n => (n -> n -> n) -> T3 n -> F_U3 n
rlpf_f n -> n -> n
max_f T3 n
param n
x n
y1 n
y2 =
let (n
a0,n
b1,n
b2) = forall n. Floating n => (n -> n -> n) -> (n, n, n) -> (n, n, n)
Filter.rlpf_coef n -> n -> n
max_f T3 n
param
in n
a0 forall a. Num a => a -> a -> a
* n
x forall a. Num a => a -> a -> a
+ n
b1 forall a. Num a => a -> a -> a
* n
y1 forall a. Num a => a -> a -> a
+ n
b2 forall a. Num a => a -> a -> a
* n
y2
rlpf_ir :: (Floating n, Ord n) => T3 n -> F_ST1 (T2 n) n n
rlpf_ir :: forall n. (Floating n, Ord n) => T3 n -> F_ST1 (T2 n) n n
rlpf_ir T3 n
p = forall n. F_U3 n -> F_ST1 (T2 n) n n
iir2 (forall n. Floating n => (n -> n -> n) -> T3 n -> F_U3 n
rlpf_f forall a. Ord a => a -> a -> a
max T3 n
p)
bw_hpf_ir :: Floating n => T2 n -> F_ST1 (T4 n) n n
bw_hpf_ir :: forall n. Floating n => T2 n -> F_ST1 (T4 n) n n
bw_hpf_ir (n
sample_rate,n
f) = forall n. Num n => T5 n -> F_ST1 (T4 n) n n
sos (forall n. Floating n => Bool -> n -> n -> SosCoef n
Filter.bw_lpf_or_hpf_coef Bool
True n
sample_rate n
f)
bw_lpf_ir :: Floating n => T2 n -> F_ST1 (T4 n) n n
bw_lpf_ir :: forall n. Floating n => T2 n -> F_ST1 (T4 n) n n
bw_lpf_ir (n
sample_rate,n
f) = forall n. Num n => T5 n -> F_ST1 (T4 n) n n
sos (forall n. Floating n => Bool -> n -> n -> SosCoef n
Filter.bw_lpf_or_hpf_coef Bool
False n
sample_rate n
f)
white_noise :: (R.RandomGen g, Fractional n, R.Random n) => F_ST0 g n
white_noise :: forall g n. (RandomGen g, Fractional n, Random n) => F_ST0 g n
white_noise = forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
R.randomR (-n
1.0,n
1.0)
brown_noise_f :: (Fractional n, Ord n) => n -> n -> n
brown_noise_f :: forall n. (Fractional n, Ord n) => n -> n -> n
brown_noise_f n
x n
y1 =
let z :: n
z = n
x forall a. Num a => a -> a -> a
+ n
y1
in if n
z forall a. Ord a => a -> a -> Bool
> n
1.0 then n
2.0 forall a. Num a => a -> a -> a
- n
z else if n
z forall a. Ord a => a -> a -> Bool
< (-n
1.0) then (-n
2.0) forall a. Num a => a -> a -> a
- n
z else n
z
brown_noise :: (R.RandomGen g, Fractional n, R.Random n, Ord n) => F_ST0 (g,n) n
brown_noise :: forall g n.
(RandomGen g, Fractional n, Random n, Ord n) =>
F_ST0 (g, n) n
brown_noise (g
g,n
y1) =
let (n
n,g
g') = forall g n. (RandomGen g, Fractional n, Random n) => F_ST0 g n
white_noise g
g
r :: n
r = forall n. (Fractional n, Ord n) => n -> n -> n
brown_noise_f (n
n forall n. Fractional n => F_U2 n
/ n
8.0) n
y1
in (n
r,(g
g',n
r))
pk_pinking_filter_f :: Fractional a => (a, a, a, a, a, a, a) -> a -> (a, (a, a, a, a, a, a, a))
pk_pinking_filter_f :: forall a.
Fractional a =>
(a, a, a, a, a, a, a) -> a -> (a, (a, a, a, a, a, a, a))
pk_pinking_filter_f (a
b0,a
b1,a
b2,a
b3,a
b4,a
b5,a
b6) a
w =
let b0' :: a
b0' = a
0.99886 forall a. Num a => a -> a -> a
* a
b0 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.0555179
b1' :: a
b1' = a
0.99332 forall a. Num a => a -> a -> a
* a
b1 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.0750759
b2' :: a
b2' = a
0.96900 forall a. Num a => a -> a -> a
* a
b2 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.1538520
b3' :: a
b3' = a
0.86650 forall a. Num a => a -> a -> a
* a
b3 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.3104856
b4' :: a
b4' = a
0.55000 forall a. Num a => a -> a -> a
* a
b4 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.5329522
b5' :: a
b5' = -a
0.7616 forall a. Num a => a -> a -> a
* a
b5 forall a. Num a => a -> a -> a
- a
w forall a. Num a => a -> a -> a
* a
0.0168980
p :: a
p = a
b0 forall a. Num a => a -> a -> a
+ a
b1 forall a. Num a => a -> a -> a
+ a
b2 forall a. Num a => a -> a -> a
+ a
b3 forall a. Num a => a -> a -> a
+ a
b4 forall a. Num a => a -> a -> a
+ a
b5 forall a. Num a => a -> a -> a
+ a
b6 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.5362
b6' :: a
b6' = a
w forall a. Num a => a -> a -> a
* a
0.115926
in (a
p,(a
b0',a
b1',a
b2',a
b3',a
b4',a
b5',a
b6'))
pk_pinking_filter_economy_f :: Fractional a => (a, a, a) -> a -> (a, (a, a, a))
pk_pinking_filter_economy_f :: forall a. Fractional a => (a, a, a) -> a -> (a, (a, a, a))
pk_pinking_filter_economy_f (a
b0,a
b1,a
b2) a
w =
let b0' :: a
b0' = a
0.99765 forall a. Num a => a -> a -> a
* a
b0 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.0990460
b1' :: a
b1' = a
0.96300 forall a. Num a => a -> a -> a
* a
b1 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.2965164
b2' :: a
b2' = a
0.57000 forall a. Num a => a -> a -> a
* a
b2 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
1.0526913
p :: a
p = a
b0 forall a. Num a => a -> a -> a
+ a
b1 forall a. Num a => a -> a -> a
+ a
b2 forall a. Num a => a -> a -> a
+ a
w forall a. Num a => a -> a -> a
* a
0.1848
in (a
p,(a
b0',a
b1',a
b2'))
decay_f :: Floating a => a -> a -> a -> a -> a
decay_f :: forall a. Floating a => a -> a -> a -> a -> a
decay_f a
sr a
dt a
x a
y1 =
let b1 :: a
b1 = forall n. Floating n => n -> n
exp (forall n. Floating n => n -> n
log a
0.001 forall n. Fractional n => F_U2 n
/ (a
dt forall a. Num a => a -> a -> a
* a
sr))
in a
x forall a. Num a => a -> a -> a
+ a
b1 forall a. Num a => a -> a -> a
* a
y1
lag_f_frames :: Floating a => a -> a -> a -> a
lag_f_frames :: forall a. Floating a => a -> a -> a -> a
lag_f_frames a
dt a
x a
y1 = let b1 :: a
b1 = forall n. Floating n => n -> n
exp (forall n. Floating n => n -> n
log a
0.001 forall n. Fractional n => F_U2 n
/ a
dt) in a
x forall a. Num a => a -> a -> a
+ a
b1 forall a. Num a => a -> a -> a
* (a
y1 forall a. Num a => a -> a -> a
- a
x)
lag_f :: Floating a => a -> a -> a -> a -> a
lag_f :: forall a. Floating a => a -> a -> a -> a -> a
lag_f a
sr a
dt = forall a. Floating a => a -> a -> a -> a
lag_f_frames (a
dt forall a. Num a => a -> a -> a
* a
sr)
lag :: Floating t => t -> F_ST1 t (t,t) t
lag :: forall t. Floating t => t -> F_ST1 t (t, t) t
lag t
sr ((t
i,t
t),t
st) = let r :: t
r = forall a. Floating a => a -> a -> a -> a -> a
lag_f t
sr t
t t
i t
st in (t
r,t
r)
slope :: Num t => t -> F_ST1 t t t
slope :: forall t. Num t => t -> F_ST1 t t t
slope t
sr = forall n. F_U2 n -> F_ST1 n n n
fir1 (\t
n t
z0 -> (t
n forall a. Num a => a -> a -> a
- t
z0) forall a. Num a => a -> a -> a
* t
sr)
latch :: F_ST1 t (t,Bool) t
latch :: forall t. F_ST1 t (t, Bool) t
latch ((t
n,Bool
b),t
y1) = let r :: t
r = if Bool
b then t
n else t
y1 in (t
r,t
r)
as_trig :: (Fractional t,Ord t) => F_ST1 t t Bool
as_trig :: forall t. (Fractional t, Ord t) => F_ST1 t t Bool
as_trig (t
n,t
y1) = (t
y1 forall a. Ord a => a -> a -> Bool
<= t
0.0 Bool -> Bool -> Bool
&& t
n forall a. Ord a => a -> a -> Bool
> t
0.0,t
n)
phasor :: RealFrac t => F_ST1 t (Bool,t,t,t,t) t
phasor :: forall t. RealFrac t => F_ST1 t (Bool, t, t, t, t) t
phasor ((Bool
trig,t
rate,t
start,t
end,t
resetPos),t
ph) =
let r :: t
r = if Bool
trig then t
resetPos else forall n. RealFrac n => n -> n -> n -> n
sc3_wrap t
start t
end (t
ph forall a. Num a => a -> a -> a
+ t
rate)
in (t
ph,t
r)
mod_dif :: RealFrac a => a -> a -> a -> a
mod_dif :: forall n. RealFrac n => n -> n -> n -> n
mod_dif a
i a
j a
m =
let d :: a
d = forall a. Num a => a -> a -> a
absdif a
i a
j forall n. RealFrac n => n -> n -> n
`sc3_mod` a
m
h :: a
h = a
m forall a. Num a => a -> a -> a
* a
0.5
in a
h forall a. Num a => a -> a -> a
- forall a. Num a => a -> a -> a
absdif a
d a
h
l_apply_f_st0 :: F_ST0 st o -> st -> [o]
l_apply_f_st0 :: forall st o. F_ST0 st o -> st -> [o]
l_apply_f_st0 F_ST0 st o
f st
st = let (o
r,st
st') = F_ST0 st o
f st
st in o
r forall a. a -> [a] -> [a]
: forall st o. F_ST0 st o -> st -> [o]
l_apply_f_st0 F_ST0 st o
f st
st'
l_white_noise :: (Enum e, Fractional n, R.Random n) => e -> [n]
l_white_noise :: forall e n. (Enum e, Fractional n, Random n) => e -> [n]
l_white_noise e
e = forall st o. F_ST0 st o -> st -> [o]
l_apply_f_st0 forall g n. (RandomGen g, Fractional n, Random n) => F_ST0 g n
white_noise (Int -> StdGen
R.mkStdGen (forall a. Enum a => a -> Int
fromEnum e
e))
l_brown_noise :: (Enum e, Fractional n, Ord n, R.Random n) => e -> [n]
l_brown_noise :: forall e n. (Enum e, Fractional n, Ord n, Random n) => e -> [n]
l_brown_noise e
e = forall st o. F_ST0 st o -> st -> [o]
l_apply_f_st0 forall g n.
(RandomGen g, Fractional n, Random n, Ord n) =>
F_ST0 (g, n) n
brown_noise (Int -> StdGen
R.mkStdGen (forall a. Enum a => a -> Int
fromEnum e
e),n
0.0)
l_apply_f_st1 :: F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 :: forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 F_ST1 st i o
f st
st [i]
xs =
case [i]
xs of
[] -> []
i
x:[i]
xs' -> let (o
r,st
st') = F_ST1 st i o
f (i
x,st
st) in o
r forall a. a -> [a] -> [a]
: forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 F_ST1 st i o
f st
st' [i]
xs'
l_lag :: Floating t => t -> [t] -> [t] -> [t]
l_lag :: forall t. Floating t => t -> [t] -> [t] -> [t]
l_lag t
sr [t]
i [t]
t = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 (forall t. Floating t => t -> F_ST1 t (t, t) t
lag t
sr) t
0 (forall a b. [a] -> [b] -> [(a, b)]
zip [t]
i [t]
t)
l_slope :: Floating t => t -> [t] -> [t]
l_slope :: forall t. Floating t => t -> [t] -> [t]
l_slope t
sr = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 (forall t. Num t => t -> F_ST1 t t t
slope t
sr) t
0
l_phasor :: RealFrac n => [Bool] -> [n] -> [n] -> [n] -> [n] -> [n]
l_phasor :: forall n. RealFrac n => [Bool] -> [n] -> [n] -> [n] -> [n] -> [n]
l_phasor [Bool]
trig [n]
rate [n]
start [n]
end [n]
resetPos =
let i :: [(Bool, n, n, n, n)]
i = forall a b c d e.
[a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]
zip5 [Bool]
trig [n]
rate [n]
start [n]
end [n]
resetPos
in forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall t. RealFrac t => F_ST1 t (Bool, t, t, t, t) t
phasor (forall a. [a] -> a
head [n]
start) [(Bool, n, n, n, n)]
i
l_phasor_osc :: RealFrac n => n -> n -> [n] -> [n]
l_phasor_osc :: forall n. RealFrac n => n -> n -> [n] -> [n]
l_phasor_osc n
sr n
k [n]
f =
let rp :: a -> [a]
rp = forall a. a -> [a]
repeat
in forall n. RealFrac n => [Bool] -> [n] -> [n] -> [n] -> [n] -> [n]
l_phasor (forall a. a -> [a]
rp Bool
False) (forall a b. (a -> b) -> [a] -> [b]
map (forall n. Fractional n => F_U3 n
cps_to_incr n
sr n
k) [n]
f) (forall a. a -> [a]
rp n
0) (forall a. a -> [a]
rp n
k) (forall a. a -> [a]
rp n
0)
l_sin_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]
l_sin_osc :: forall n. (Floating n, RealFrac n) => n -> [n] -> [n]
l_sin_osc n
sr [n]
f = forall a b. (a -> b) -> [a] -> [b]
map forall n. Floating n => n -> n
sin (forall n. RealFrac n => n -> n -> [n] -> [n]
l_phasor_osc n
sr forall n. Floating n => n
two_pi [n]
f)
l_cos_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]
l_cos_osc :: forall n. (Floating n, RealFrac n) => n -> [n] -> [n]
l_cos_osc n
sr [n]
f = forall a b. (a -> b) -> [a] -> [b]
map forall n. Floating n => n -> n
cos (forall n. RealFrac n => n -> n -> [n] -> [n]
l_phasor_osc n
sr forall n. Floating n => n
two_pi [n]
f)
l_hpz1 :: Fractional n => [n] -> [n]
l_hpz1 :: forall n. Fractional n => [n] -> [n]
l_hpz1 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 n n n
hpz1 n
0
l_hpz2 :: Fractional n => [n] -> [n]
l_hpz2 :: forall n. Fractional n => [n] -> [n]
l_hpz2 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 (T2 n) n n
hpz2 (n
0,n
0)
l_lpz1 :: Fractional n => [n] -> [n]
l_lpz1 :: forall n. Fractional n => [n] -> [n]
l_lpz1 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 n n n
lpz1 n
0
l_lpz2 :: Fractional n => [n] -> [n]
l_lpz2 :: forall n. Fractional n => [n] -> [n]
l_lpz2 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 (T2 n) n n
lpz2 (n
0,n
0)
l_bpz2 :: Fractional n => [n] -> [n]
l_bpz2 :: forall n. Fractional n => [n] -> [n]
l_bpz2 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 (T2 n) n n
bpz2 (n
0,n
0)
l_brz2 :: Fractional n => [n] -> [n]
l_brz2 :: forall n. Fractional n => [n] -> [n]
l_brz2 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 (T2 n) n n
brz2 (n
0,n
0)
l_bw_hpf :: Floating n => T2 n -> [n] -> [n]
l_bw_hpf :: forall n. Floating n => T2 n -> [n] -> [n]
l_bw_hpf T2 n
p = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 (forall n. Floating n => T2 n -> F_ST1 (T4 n) n n
bw_hpf_ir T2 n
p) (n
0,n
0,n
0,n
0)
l_bw_lpf :: Floating n => T2 n -> [n] -> [n]
l_bw_lpf :: forall n. Floating n => T2 n -> [n] -> [n]
l_bw_lpf T2 n
p = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 (forall n. Floating n => T2 n -> F_ST1 (T4 n) n n
bw_lpf_ir T2 n
p) (n
0,n
0,n
0,n
0)
l_resonz_ir :: Floating n => T3 n -> [n] -> [n]
l_resonz_ir :: forall n. Floating n => T3 n -> [n] -> [n]
l_resonz_ir T3 n
p = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 (forall n. Floating n => T3 n -> F_ST1 (T2 n) n n
resonz_ir T3 n
p) (n
0,n
0)
l_rlpf_ir :: (Floating n, Ord n) => T3 n -> [n] -> [n]
l_rlpf_ir :: forall n. (Floating n, Ord n) => T3 n -> [n] -> [n]
l_rlpf_ir T3 n
p = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 (forall n. (Floating n, Ord n) => T3 n -> F_ST1 (T2 n) n n
rlpf_ir T3 n
p) (n
0,n
0)
l_mavg5 :: Fractional n => [n] -> [n]
l_mavg5 :: forall n. Fractional n => [n] -> [n]
l_mavg5 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 (T4 n) n n
mavg5 (n
0,n
0,n
0,n
0)
l_mavg9 :: Fractional n => [n] -> [n]
l_mavg9 :: forall n. Fractional n => [n] -> [n]
l_mavg9 = forall st i o. F_ST1 st i o -> st -> [i] -> [o]
l_apply_f_st1 forall n. Fractional n => F_ST1 (T8 n) n n
mavg9 (n
0,n
0,n
0,n
0,n
0,n
0,n
0,n
0)