-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemphasis_transformer
More file actions
64 lines (52 loc) · 1.42 KB
/
emphasis_transformer
File metadata and controls
64 lines (52 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
desc:Transformer-like saturation with pre/de-emphasis and bandwidth limiting
import cookdsp.jsfx-inc
slider1:0<0,100,1>Amount (%)
slider6:-24<-60,18,0.5>Pre-emphasis curve(dB, neg or pos)
slider7:2500<1000,7000,1>Pre-emphasis filter frequency (Hz)
slider8:1<1,1.7,0.01>Pre/de-emphasis center mismatch (bass boost) (Hz)
@init
gfx_clear = 0;
//dc_remove
itm1=itm2=otm1=otm2=0;
//Pre-emphasis
LS.eq(slider7,0.1,slider6,0);
RS.eq(slider7,0.1,slider6,0);
//De-emphasis
Lde.eq((slider7*-slider8),(0.1),(-slider6),0);
Rde.eq((slider7*-slider8),(0.1),(-slider6),0);
@slider
foo=slider1/200*$pi;
bar = sin(slider1/200*$pi);
//Pre-emphasis
LS.eq_set_freq(slider7);
RS.eq_set_freq(slider7);
LS.eq_set_boost(slider6);
RS.eq_set_boost(slider6);
//De-emphasis
Lde.eq_set_freq(slider7/slider8);
Rde.eq_set_freq(slider7/slider8);
Lde.eq_set_boost(-slider6);
Rde.eq_set_boost(-slider6);
Lde.eq_set_q(0.1);
Rde.eq_set_q(0.1);
@sample
//Pre-emphasis
slider6 != 0 ? (
spl0 = LS.eq_do(spl0);
spl1 = RS.eq_do(spl1);
);
//Saturation
slider1 ? (
spl0 = min(max( sin(max(min(spl0,1),-1)*foo)/bar ,-1) ,1);
spl1 = min(max( sin(max(min(spl1,1),-1)*foo)/bar ,-1) ,1);
);
//De-emphasis
slider6 != 0 ? (
spl0 = Lde.eq_do(spl0);
spl1 = Rde.eq_do(spl1);
);
//dc_remove
//slider12 == 0 ? (
otm1=0.999*otm1 + spl0 - itm1; itm1=spl0; spl0=otm1;
otm2=0.999*otm2 + spl1 - itm2; itm2=spl1; spl1=otm2;
// );