forked from junh1024/Reaper-Surround
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.0 Pan Analyzer V2 (M).txt
100 lines (60 loc) · 1.72 KB
/
2.0 Pan Analyzer V2 (M).txt
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
desc:
slider1:0.1<-1,1,0.1>Threshold
slider2:1024<128,8192,128>Blocksize
slider3:0.5<0.1,1,0.1>Responsiveness
slider4:0<0,2,0.01>Pan
slider5:0<0,2,0.01>Rear
slider7:0.9<0,2,0.01>Thresh Start Rear
slider8:9.0<0,2,0.01>Thresh End Rear
// multiplier
@init
delta=0.01;
count=0;
sumMid=0+delta;
sumSide=0;
Mid_abs=0;
Side_abs =0;
pan_temp=0;
front_coeff=0;
back_coeff =0;
@sample
Mid=(spl0+spl1)*0.5;//compute Mid/Side
Side=(spl0-spl1)*0.5;
Mid_abs =Mid*sign(Mid) ; //get magnitude
Side_abs=Side*sign(Side) ;
// ===
// Mid=spl0+spl1;
// Side=spl0-spl1;
// C_temp = (Mid)*.707;
// L_temp = (Side)*.5;
//make it as wide as appropriate, based on analysis temp width_coeff, comparing the size of side vs mid.
spl2=Mid*1.4*(width_coeff);
spl0= Mid*(1-(width_coeff)) + Side ;
spl1= Mid*(1-(width_coeff)) - Side ;
// ====
sumMid+=Mid_abs;
sumSide+=Side_abs;
count+=1;//keep count of blocksize
(count>slider2)?//if blocksize full,
(
slider4=(((sumSide)/(sumMid))*slider3)+(slider4*(1-slider3));//do avg of all samples, with time weighting, calculate pan
(slider4 <= slider7)? //front, no rear, compute front pans
(slider5=0;
width_coeff=1-( min(slider4,1));
);
(slider4 > slider7 && slider4<= slider8 ) ? //within rear pan transition threshold, push to back as appropriate
(
pan_temp= ( ((slider4)*$pi)/((slider8-slider7)*2) );//normalize pan, scaling
//calculate pan to rear
front_coeff=cos(pan_temp);
back_coeff=sin(pan_temp);
slider5=back_coeff;
);
(slider4 > slider8)? //exceeded all thesholds, push fully back
(slider5=1;);
sumMid=0+delta;
sumSide=0;
count=0;
);
// );
// if pan<.2, centerize it, if pan >1 , put to back.