Category Archives: Pans
Pan, Delay Pro
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - initial release
24
25 **********************************************************************/
26
Disclaimer...
27 desc:Pan: Delay Pro, v1.1.0
28
29 slider1:0<-72,72,1>Buffer Length [samples]
30 slider2:0<0,10,0.1>Max Attenuation [dB]
31
32
33 @init
34 buf = 0; // buffer exists at offset 0
35 bufposR = 0;
36 delay = 0;
37 bufposW = delay;
38 buflength = 72; // good value for headphones
39 // may not be ideal for speakers
40 m = 1.0;
41
42
43 @slider
44 delay = slider1;
45 d = delay;
46 d < 0 ? d = d * -1; // absolute value
47 bufposR = bufposW - d;
48 bufposR < 0 ? bufposR = bufPosR + buflength;
49
50 b = abs((slider1) / 72);
51 c = -b * slider2; // scale; no att. at 12:00
52 m = pow(10, (c /20));
53
54
55 @sample
56 delay == 0 ? (
57 spl0=spl0;
58 spl1=spl1;
59 ) : (
60 delay < 0 ? (
61 x = spl1;
62 spl1 = buf[bufposR] *= m;
63 buf[bufposW] = x;
64 bufposR = bufposR + 1 ;
65 bufposR > buflength ? bufposR = 0;
66 bufposW = bufposW + 1 ;
67 bufposW > buflength ? bufposW = 0;
68
69 spl0 = spl0;
70
71 ) : (
72 x = spl0;
73 spl0 = buf[bufposR] *= m;
74 buf[bufposW] = x;
75 bufposR = bufposR + 1 ;
76 bufposR > buflength ? bufposR = 0;
77 bufposW = bufposW + 1 ;
78 bufposW > buflength ? bufposW = 0;
79
80 spl1 = spl1;
81 );
82 );
83
Pan, Lo Pass Pro
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - initial release
24
25 **********************************************************************/
26
Disclaimer...
27 desc:Pan: Lo Pass Pro, v1.1.0
28
29 slider1:0<-120,120,0.1>Pan Angle [degrees]
30 slider2:0<0,10,0.1>Max Attenuation [dB]
31
32 @init
33 x=0;
34 x1=0;
35 x2=0;
36 y=0;
37 y1=0;
38 y2=0;
39 d=1.414;
40 who = 0;
41
42 m = 1;
43
44
45 @slider
46 who = slider1;
47 f = slider1 * 60/120; // 0 < f < 60
48 f > 0 ? f = f * -1; // -60 < f < 0
49 dd = pow(2, f/8.0)*16000; // 16,000 -> 500 Hz
50 w = 2.0 * $pi * dd / srate;
51 mBeta = 0.5 * (( 1.0 - d / 2.0 * sin(w) ) / ( 1.0 + d / 2.0 * sin(w) ));
52 mGamma = ( 0.5 + mBeta ) * cos(w);
53 mAlpha = ( 0.5 + mBeta - mGamma ) / 4.0;
54
55 b = abs((slider1) / 72);
56 c = -b * slider2; // scale; no att. at 12:00
57 m = pow(10, (c /20));
58
59
60 @sample
61 who == 0 ? (
62 spl0=spl0;
63 spl1=spl1;
64 ) : (
65 who < 0 ? (
66 x = spl1;
67 y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
68 x2 = x1;
69 x1 = x;
70 y2 = y1;
71 y1 = y;
72 spl1 = y *= m;
73 spl0 = spl0;
74
75 ) : (
76 x = spl0;
77 y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
78 x2 = x1;
79 x1 = x;
80 y2 = y1;
81 y1 = y;
82 spl0 = y *= m;
83 spl1 = spl1;
84 );
85 );
86
Pan, Lo Pass
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - pan angle changed from 45->120
24 f/12 changed to f/8
25 v1.0.0 - initial release
26
27 **********************************************************************/
28
Disclaimer...
29 desc:Pan: Lo Pass, v1.1.0
30
31 slider1:0<-120,120,0.1>Pan Angle [degrees]
32
33 @init
34 x=0;
35 x1=0;
36 x2=0;
37 y=0;
38 y1=0;
39 y2=0;
40 d=1.414;
41 who = 0;
42
43 @slider
44 who = slider1;
45 f = slider1 * 60/120; // 0 < f < 60
46 f > 0 ? f = f * -1; // -60 < f < 0
47 dd = pow(2, f/8.0)*16000; // 16,000 -> 500 Hz
48 w = 2.0 * $pi * dd / srate;
49 mBeta = 0.5 * (( 1.0 - d / 2.0 * sin(w) ) / ( 1.0 + d / 2.0 * sin(w) ));
50 mGamma = ( 0.5 + mBeta ) * cos(w);
51 mAlpha = ( 0.5 + mBeta - mGamma ) / 4.0;
52
53 @sample
54 who == 0 ? (
55 spl0=spl0;
56 spl1=spl1;
57 ) : (
58 who < 0 ? (
59 x = spl1;
60 y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
61 x2 = x1;
62 x1 = x;
63 y2 = y1;
64 y1 = y;
65 spl1 = y;
66 spl0 = spl0;
67
68 ) : (
69 x = spl0;
70 y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
71 x2 = x1;
72 x1 = x;
73 y2 = y1;
74 y1 = y;
75 spl0 = y;
76 spl1 = spl1;
77 );
78 );
79
Pan, Delay
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - changed slider1 max = 72, not 20
24 v1.0.0 - initial release
25
26 **********************************************************************/
27
Disclaimer...
28 desc:Pan: Delay, v1.1.0
29
30 slider1:0<-72,72,1>Buffer Length [samples]
31
32
33 @init
34 buf = 0; // buffer exists at offset 0
35 bufposR = 0;
36 delay = 0;
37 bufposW = delay;
38 buflength = 72; // good value for headphones
39 // may not be ideal for speakers
40
41 @slider
42 delay = slider1;
43 d = delay;
44 d < 0 ? d = d * -1; // absolute value
45 bufposR = bufposW - d;
46 bufposR < 0 ? bufposR = bufPosR + buflength;
47
48
49 @sample
50 delay == 0 ? (
51 spl0=spl0;
52 spl1=spl1;
53 ) : (
54 delay < 0 ? (
55 x = spl1;
56 spl1 = buf[bufposR];
57 buf[bufposW] = x;
58 bufposR = bufposR + 1 ;
59 bufposR > buflength ? bufposR = 0;
60 bufposW = bufposW + 1 ;
61 bufposW > buflength ? bufposW = 0;
62
63 spl0 = spl0;
64
65 ) : (
66 x = spl0;
67 spl0 = buf[bufposR];
68 buf[bufposW] = x;
69 bufposR = bufposR + 1 ;
70 bufposR > buflength ? bufposR = 0;
71 bufposW = bufposW + 1 ;
72 bufposW > buflength ? bufposW = 0;
73
74 spl1 = spl1;
75 );
76 );
77
Pan, Binaural
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - pan angle changed from 45->120
24 buflength changed from 20->72
25 v1.0.0 - initial release
26
27 **********************************************************************/
28
Disclaimer...
29 desc:Pan, Binaural, v1.1.0
30
31 slider1:0<-120,120,0.1>Pan Angle [degrees]
32
33 @init
34 x=0;
35 x1=0;
36 x2=0;
37 y=0;
38 y1=0;
39 y2=0;
40 d=1.414;
41 who = 0;
42
43 buf = 0; // buffer exists at offset 0
44 bufposR = 0;
45 delay = 0;
46 bufposW = delay;
47 buflength = 72;
48
49 m = 1;
50 gainL = 0.707106781186547;
51 gainR = 0.707106781186547;
52
53
54 @slider
55 who = slider1;
56
57 // lo pass pan
58 f = slider1 * 60/120; // 0 < f < 60
59 f > 0 ? f = f * -1; // -60 < f < 0
60 dd = pow(2, f/12.0)*16000; // 16,000 -> 500 Hz
61 w = 2.0 * $pi * dd / srate;
62 mBeta = 0.5 * (( 1.0 - d / 2.0 * sin(w) ) / ( 1.0 + d / 2.0 * sin(w) ));
63 mGamma = ( 0.5 + mBeta ) * cos(w);
64 mAlpha = ( 0.5 + mBeta - mGamma ) / 4.0;
65
66 // delay pan
67 delay = slider1 * 72/120;
68 d1 = delay;
69 d1 < 0 ? d1 = d1 * -1; // absolute value
70 bufposR = bufposW - d1;
71 bufposR < 0 ? bufposR = bufPosR + buflength;
72
73 // cos pan
74 m = slider1;
75 m = slider1 + 120;
76 m *= 90/240;
77 gainL = cos( m * $pi / 180.0 );
78 gainR = sin( m * $pi / 180.0 );
79
80
81 @sample
82 who == 0 ? (
83 spl0 *= gainL;
84 spl1 *= gainR;
85 ) : (
86 who < 0 ? (
87 x = spl1;
88 spl1 = buf[bufposR];
89 buf[bufposW] = x;
90 bufposR = bufposR + 1 ;
91 bufposR > buflength ? bufposR = 0;
92 bufposW = bufposW + 1 ;
93 bufposW > buflength ? bufposW = 0;
94
95 x = spl1;
96 y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
97 x2 = x1;
98 x1 = x;
99 y2 = y1;
100 y1 = y;
101 spl1 = y * gainR;
102 spl0 *= gainL;
103
104 ) : (
105 x = spl0;
106 spl0 = buf[bufposR];
107 buf[bufposW] = x;
108 bufposR = bufposR + 1 ;
109 bufposR > buflength ? bufposR = 0;
110 bufposW = bufposW + 1 ;
111 bufposW > buflength ? bufposW = 0;
112
113 x = spl0;
114 y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
115 x2 = x1;
116 x1 = x;
117 y2 = y1;
118 y1 = y;
119 spl0 = y * gainL;
120 spl1 *= gainR;
121 );
122 );
123
Pan, Cos [-4.5dB]
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - added GUI
24 v1.0.0 - initial release
25
26 **********************************************************************/
27
Disclaimer...
28 desc:Pan: Cos [-4.5dB], v1.1.0
29
30 slider1:0<-120,120,0.1>Pan Angle [degrees]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 m = 0;
35 gainL = 0.59460355750136;
36 gainR = 0.59460355750136;
37
38 @slider
39 m = slider1 + 120;
40 m *= 90/240;
41 gainL = pow(cos( m * $pi / 180.0 ), 1.5);
42 gainR = pow(sin( m * $pi / 180.0 ), 1.5);
43
44 @sample
45 spl0 *= gainL;
46 spl1 *= gainR;
47
Graphics...
49 @gfx 256 256
50 gfx_setfont(1, "Arial", 10);
51 gfx_a = 1;
52
53 gfx_r = gfx_g = gfx_b = 0.1;
54 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
55 gfx_line(0, 0, 0, gfx_h, 0.5);
56 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
57 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
58
59 x_step = gfx_w / 10;
60 y_step = gfx_h / 10;
61
62 i = 1;
63 loop(9, // y-axiis
64 x = i*x_step;
65 gfx_line(x, y_step, x, y_step*7, 0.5);
66 i += 1;
67 );
68
69 gfx_x = x_step - 15;
70 gfx_y = gfx_h - 3*y_step + 9;
71 sprintf(str, "%.1f˚", -120);
72 gfx_drawstr(str);
73
74 gfx_x = 3*x_step - 11;
75 gfx_y = gfx_h - 3*y_step + 9;
76 sprintf(str, "%.1f˚", -60);
77 gfx_drawstr(str);
78
79 gfx_x = 5*x_step - 7;
80 gfx_y = gfx_h - 3*y_step + 9;
81 sprintf(str, "%.1f˚", 0);
82 gfx_drawstr(str);
83
84 gfx_x = 7*x_step - 11;
85 gfx_y = gfx_h - 3*y_step + 9;
86 sprintf(str, "+%.1f˚", 60);
87 gfx_drawstr(str);
88
89 gfx_x = 9*x_step - 15;
90 gfx_y = gfx_h - 3*y_step + 9;
91 sprintf(str, "+%.1f˚", 120);
92 gfx_drawstr(str);
93
94 i = 1;
95 loop(7, // x-axiis
96 y = i*y_step;
97 gfx_line(x_step-2, y, x_step*9, y, 0.5);
98 i += 1;
99 );
100
101 gfx_x = x_step - 32;
102 gfx_y = y_step - 6;
103 gfx_drawchar($' ');
104 gfx_drawchar($'0');
105 gfx_drawchar($' ');
106 gfx_drawchar($'d');
107 gfx_drawchar($'B');
108
109 gfx_x = x_step - 33;
110 gfx_y = 2*y_step - 7;
111 gfx_drawchar($'-');
112 gfx_drawchar($' ');
113 gfx_drawchar($'3');
114 gfx_drawchar($'d');
115 gfx_drawchar($'B');
116
117 gfx_x = x_step - 33;
118 gfx_y = 3*y_step - 7;
119 gfx_drawchar($'-');
120 gfx_drawchar($' ');
121 gfx_drawchar($'6');
122 gfx_drawchar($'d');
123 gfx_drawchar($'B');
124
125 gfx_x = x_step - 33;
126 gfx_y = 4*y_step - 7;
127 gfx_drawchar($'-');
128 gfx_drawchar($' ');
129 gfx_drawchar($'9');
130 gfx_drawchar($'d');
131 gfx_drawchar($'B');
132
133 gfx_x = x_step - 36;
134 gfx_y = 5*y_step - 7;
135 gfx_drawchar($'-');
136 gfx_drawchar($'1');
137 gfx_drawchar($'2');
138 gfx_drawchar($'d');
139 gfx_drawchar($'B');
140
141 gfx_x = x_step - 36;
142 gfx_y = 6*y_step - 7;
143 gfx_drawchar($'-');
144 gfx_drawchar($'1');
145 gfx_drawchar($'5');
146 gfx_drawchar($'d');
147 gfx_drawchar($'B');
148
149 gfx_x = x_step - 36;
150 gfx_y = 7*y_step - 7;
151 gfx_drawchar($'-');
152 gfx_drawchar($'1');
153 gfx_drawchar($'8');
154 gfx_drawchar($'d');
155 gfx_drawchar($'B');
156
157 pos = slider1 + 120;
158 gfx_r = gfx_g = 0.1;
159 gfx_b = 0.9;
160 dB = 20 * log10(gainR);
161 dB *= -1;
162 pos == 0 ? dB = 99.9;
163 m == 0 ? dB = 99.9;
164 y = y_step*dB/3 + y_step;
165 y > y_step*7 - 1 ? y = y_step*7 - 1;
166 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
167 gfx_rect(x_step+pos/240*x_step*8, y_step+2, 1, y_step*6-3, 0.5);// vertical line
168 gfx_rect(x_step+pos/240*x_step*8-3, y-2, 7, 6, 0.5); // hilite box
169 gfx_x = gfx_w*.9+8;
170 gfx_y = y-6;
171 sprintf(str, "%.1fdB", -dB);
172 gfx_drawstr(str);
173 gfx_x = x_step+pos/240*x_step*8-9;
174 gfx_y = y_step - 17;
175 sprintf(str, "%.1f˚", slider1);
176 gfx_drawstr(str);
177
178 gfx_g = 0.2;
179 gfx_b = gfx_r = 0.9;
180 RES = 100; // min = 8
181 x_step1 = x_step * 8/RES;
182
183 i = 1;
184 loop(RES, //8, // main curve
185 x = i*x_step1;
186
187 c=(240*(i-1)/RES)-120;
188 m1 = c + 120;
189 m1 *= 90/240;
190 gainR1 = pow(sin( m1 * $pi / 180.0 ), 1.5);
191 dB1 = -20 * log10(gainR1);
192 dB1 > 18 ? dB1 = 18;
193 i == 1 ? dB1 = 18;
194 y = y_step*dB1/3 + y_step;
195
196 c=(240*(i)/RES)-120;
197 m2 = c + 120;
198 m2 *= 90/240;
199 gainR2 = pow(sin( m2 * $pi / 180.0 ), 1.5);
200 dB2 = -20 * log10(gainR2);
201 dB2 > 18 ? dB2 = 18;
202 i == 1 ? dB2 = 18;
203 y1 = y_step*dB2 /3 + y_step;
204
205 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
206 i += 1;
207 );
208
209 gfx_setfont(1, "Arial", 12); // main title
210 gfx_r = gfx_g = gfx_b = 0.0;
211 gfx_x = x_step;
212 gfx_y = gfx_h - y_step - 7;
213 gfx_drawstr("Cos -4.5dB Pan: Gain (dB) - vs - Pan Angle (degrees)");
214
215 // mouse
216 mouse_cap == 1 ? (
217 xx = mouse_x;
218 xx > gfx_w * 0.1 ? (
219 xx < gfx_w * 0.9 ? (
220 yy = mouse_y;
221 yy > gfx_h * 0.1 ? (
222 yy < gfx_h * 0.7 ? (
223 slider1 = 240 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1) - 120;
224 // slider1 < 0.3 ? slider1 = floor(slider1);
225 // slider1 > 99.7 ? slider1 = ceil(slider1);
226 slider1 = floor(slider1*10);
227 slider1 /= 10;
228 sliderchange(slider1);
229 slider_automate(slider1);
230 slider1 < -119 ? slider1 = -120;
231 slider1 > 119 ? slider1 = 120;
232 m = slider1 + 120;
233 m *= 90/240;
234 gainL = pow(cos( m * $pi / 180.0 ), 1.5);
235 gainR = pow(sin( m * $pi / 180.0 ), 1.5);
236 );
237 );
238 );
239 );
240 );
Pan, Cos [-3dB]
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - added GUI
24 v1.0.0 - initial release
25
26 **********************************************************************/
27
Disclaimer...
28 desc:Pan: Cos [-3dB], v1.1.0
29
30 slider1:0<-120,120,0.1>Pan Angle [degrees]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 m = 0;
35 gainL = 0.707106781186547;
36 gainR = 0.707106781186547;
37
38 @slider
39 m = slider1 + 120;
40 m *= 90/240;
41 gainL = cos( m * $pi / 180.0 );
42 gainR = sin( m * $pi / 180.0 );
43
44 @sample
45 spl0 *= gainL;
46 spl1 *= gainR;
47
Graphics...
49 @gfx 256 256
50 gfx_setfont(1, "Arial", 10);
51 gfx_a = 1;
52
53 gfx_r = gfx_g = gfx_b = 0.1;
54 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
55 gfx_line(0, 0, 0, gfx_h, 0.5);
56 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
57 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
58
59 x_step = gfx_w / 10;
60 y_step = gfx_h / 10;
61
62 i = 1;
63 loop(9, // y-axiis
64 x = i*x_step;
65 gfx_line(x, y_step, x, y_step*7, 0.5);
66 i += 1;
67 );
68
69 gfx_x = x_step - 15;
70 gfx_y = gfx_h - 3*y_step + 9;
71 sprintf(str, "%.1f˚", -120);
72 gfx_drawstr(str);
73
74 gfx_x = 3*x_step - 11;
75 gfx_y = gfx_h - 3*y_step + 9;
76 sprintf(str, "%.1f˚", -60);
77 gfx_drawstr(str);
78
79 gfx_x = 5*x_step - 7;
80 gfx_y = gfx_h - 3*y_step + 9;
81 sprintf(str, "%.1f˚", 0);
82 gfx_drawstr(str);
83
84 gfx_x = 7*x_step - 11;
85 gfx_y = gfx_h - 3*y_step + 9;
86 sprintf(str, "+%.1f˚", 60);
87 gfx_drawstr(str);
88
89 gfx_x = 9*x_step - 15;
90 gfx_y = gfx_h - 3*y_step + 9;
91 sprintf(str, "+%.1f˚", 120);
92 gfx_drawstr(str);
93
94 i = 1;
95 loop(7, // x-axiis
96 y = i*y_step;
97 gfx_line(x_step-2, y, x_step*9, y, 0.5);
98 i += 1;
99 );
100
101 gfx_x = x_step - 32;
102 gfx_y = y_step - 6;
103 gfx_drawchar($' ');
104 gfx_drawchar($'0');
105 gfx_drawchar($' ');
106 gfx_drawchar($'d');
107 gfx_drawchar($'B');
108
109 gfx_x = x_step - 33;
110 gfx_y = 2*y_step - 7;
111 gfx_drawchar($'-');
112 gfx_drawchar($' ');
113 gfx_drawchar($'3');
114 gfx_drawchar($'d');
115 gfx_drawchar($'B');
116
117 gfx_x = x_step - 33;
118 gfx_y = 3*y_step - 7;
119 gfx_drawchar($'-');
120 gfx_drawchar($' ');
121 gfx_drawchar($'6');
122 gfx_drawchar($'d');
123 gfx_drawchar($'B');
124
125 gfx_x = x_step - 33;
126 gfx_y = 4*y_step - 7;
127 gfx_drawchar($'-');
128 gfx_drawchar($' ');
129 gfx_drawchar($'9');
130 gfx_drawchar($'d');
131 gfx_drawchar($'B');
132
133 gfx_x = x_step - 36;
134 gfx_y = 5*y_step - 7;
135 gfx_drawchar($'-');
136 gfx_drawchar($'1');
137 gfx_drawchar($'2');
138 gfx_drawchar($'d');
139 gfx_drawchar($'B');
140
141 gfx_x = x_step - 36;
142 gfx_y = 6*y_step - 7;
143 gfx_drawchar($'-');
144 gfx_drawchar($'1');
145 gfx_drawchar($'5');
146 gfx_drawchar($'d');
147 gfx_drawchar($'B');
148
149 gfx_x = x_step - 36;
150 gfx_y = 7*y_step - 7;
151 gfx_drawchar($'-');
152 gfx_drawchar($'1');
153 gfx_drawchar($'8');
154 gfx_drawchar($'d');
155 gfx_drawchar($'B');
156
157 pos = slider1 + 120;
158 gfx_r = gfx_g = 0.1;
159 gfx_b = 0.9;
160 dB = 20 * log10(GainR);
161 dB *= -1;
162 pos == 0 ? dB = 99.9;
163 m == 0 ? dB = 99.9;
164 y = y_step*dB/3 + y_step;
165 y > y_step*7 - 1 ? y = y_step*7 - 1;
166 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
167 gfx_rect(x_step+pos/240*x_step*8, y_step+2, 1, y_step*6-3, 0.5);// vertical line
168 gfx_rect(x_step+pos/240*x_step*8-3, y-2, 7, 6, 0.5); // hilite box
169 gfx_x = gfx_w*.9+8;
170 gfx_y = y-6;
171 sprintf(str, "%.1fdB", -dB);
172 gfx_drawstr(str);
173 gfx_x = x_step+pos/240*x_step*8-9;
174 gfx_y = y_step - 17;
175 sprintf(str, "%.1f˚", slider1);
176 gfx_drawstr(str);
177
178 gfx_g = 0.2;
179 gfx_b = gfx_r = 0.9;
180 RES = 100; // min = 8
181 x_step1 = x_step * 8/RES;
182
183 i = 1;
184 loop(RES, //8, // main curve
185 x = i*x_step1;
186
187 c=(240*(i-1)/RES)-120;
188 m1 = c + 120;
189 m1 *= 90/240;
190 gainR1 = sin( m1 * $pi / 180.0 );
191 dB1 = -20 * log10(gainR1);
192 dB1 > 18 ? dB1 = 18;
193 i == 1 ? dB1 = 18;
194 y = y_step*dB1/3 + y_step;
195
196 c=(240*(i)/RES)-120;
197 m2 = c + 120;
198 m2 *= 90/240;
199 gainR2 = sin( m2 * $pi / 180.0 );
200 dB2 = -20 * log10(gainR2);
201 dB2 > 18 ? dB2 = 18;
202 i == 1 ? dB2 = 18;
203 y1 = y_step*dB2 /3 + y_step;
204
205 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
206 i += 1;
207 );
208
209 gfx_setfont(1, "Arial", 12); // main title
210 gfx_r = gfx_g = gfx_b = 0.0;
211 gfx_x = x_step;
212 gfx_y = gfx_h - y_step - 7;
213 gfx_drawstr("Cos -3dB Pan: Gain (dB) - vs - Pan Angle (degrees)");
214
215 // mouse
216 mouse_cap == 1 ? (
217 xx = mouse_x;
218 xx > gfx_w * 0.1 ? (
219 xx < gfx_w * 0.9 ? (
220 yy = mouse_y;
221 yy > gfx_h * 0.1 ? (
222 yy < gfx_h * 0.7 ? (
223 slider1 = 240 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1) - 120;
224 // slider1 < 0.3 ? slider1 = floor(slider1);
225 // slider1 > 99.7 ? slider1 = ceil(slider1);
226 slider1 = floor(slider1*10);
227 slider1 /= 10;
228 sliderchange(slider1);
229 slider_automate(slider1);
230 slider1 < -119 ? slider1 = -120;
231 slider1 > 119 ? slider1 = 120;
232 m = slider1 + 120;
233 m *= 90/240;
234 gainL = cos( m * $pi / 180.0 );
235 gainR = sin( m * $pi / 180.0 );
236 );
237 );
238 );
239 );
240 );
Pan, Cos [-6dB]
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - added GUI
24 v1.0.0 - initial release
25
26 **********************************************************************/
27
Disclaimer...
28 desc:Pan: Cos [-6dB], v1.1.0
29
30 slider1:0<-120,120,0.1>Pan Angle [degrees]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 m = 0;
35 gainL = 0.5;
36 gainR = 0.5;
37
38 @slider
39 m = slider1 + 120;
40 m *= 90/240;
41 gainL = pow(cos( m * $pi / 180.0 ), 2.0);
42 gainR = pow(sin( m * $pi / 180.0 ), 2.0);
43
44 @sample
45 spl0 *= gainL;
46 spl1 *= gainR;
47
Graphics...
49 @gfx 256 256
50 gfx_setfont(1, "Arial", 10);
51 gfx_a = 1;
52
53 gfx_r = gfx_g = gfx_b = 0.1;
54 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
55 gfx_line(0, 0, 0, gfx_h, 0.5);
56 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
57 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
58
59 x_step = gfx_w / 10;
60 y_step = gfx_h / 10;
61
62 i = 1;
63 loop(9, // y-axiis
64 x = i*x_step;
65 gfx_line(x, y_step, x, y_step*7, 0.5);
66 i += 1;
67 );
68
69 gfx_x = x_step - 15;
70 gfx_y = gfx_h - 3*y_step + 9;
71 sprintf(str, "%.1f˚", -120);
72 gfx_drawstr(str);
73
74 gfx_x = 3*x_step - 11;
75 gfx_y = gfx_h - 3*y_step + 9;
76 sprintf(str, "%.1f˚", -60);
77 gfx_drawstr(str);
78
79 gfx_x = 5*x_step - 7;
80 gfx_y = gfx_h - 3*y_step + 9;
81 sprintf(str, "%.1f˚", 0);
82 gfx_drawstr(str);
83
84 gfx_x = 7*x_step - 11;
85 gfx_y = gfx_h - 3*y_step + 9;
86 sprintf(str, "+%.1f˚", 60);
87 gfx_drawstr(str);
88
89 gfx_x = 9*x_step - 15;
90 gfx_y = gfx_h - 3*y_step + 9;
91 sprintf(str, "+%.1f˚", 120);
92 gfx_drawstr(str);
93
94 i = 1;
95 loop(7, // x-axiis
96 y = i*y_step;
97 gfx_line(x_step-2, y, x_step*9, y, 0.5);
98 i += 1;
99 );
100
101 gfx_x = x_step - 32;
102 gfx_y = y_step - 6;
103 gfx_drawchar($' ');
104 gfx_drawchar($'0');
105 gfx_drawchar($' ');
106 gfx_drawchar($'d');
107 gfx_drawchar($'B');
108
109 gfx_x = x_step - 33;
110 gfx_y = 2*y_step - 7;
111 gfx_drawchar($'-');
112 gfx_drawchar($' ');
113 gfx_drawchar($'3');
114 gfx_drawchar($'d');
115 gfx_drawchar($'B');
116
117 gfx_x = x_step - 33;
118 gfx_y = 3*y_step - 7;
119 gfx_drawchar($'-');
120 gfx_drawchar($' ');
121 gfx_drawchar($'6');
122 gfx_drawchar($'d');
123 gfx_drawchar($'B');
124
125 gfx_x = x_step - 33;
126 gfx_y = 4*y_step - 7;
127 gfx_drawchar($'-');
128 gfx_drawchar($' ');
129 gfx_drawchar($'9');
130 gfx_drawchar($'d');
131 gfx_drawchar($'B');
132
133 gfx_x = x_step - 36;
134 gfx_y = 5*y_step - 7;
135 gfx_drawchar($'-');
136 gfx_drawchar($'1');
137 gfx_drawchar($'2');
138 gfx_drawchar($'d');
139 gfx_drawchar($'B');
140
141 gfx_x = x_step - 36;
142 gfx_y = 6*y_step - 7;
143 gfx_drawchar($'-');
144 gfx_drawchar($'1');
145 gfx_drawchar($'5');
146 gfx_drawchar($'d');
147 gfx_drawchar($'B');
148
149 gfx_x = x_step - 36;
150 gfx_y = 7*y_step - 7;
151 gfx_drawchar($'-');
152 gfx_drawchar($'1');
153 gfx_drawchar($'8');
154 gfx_drawchar($'d');
155 gfx_drawchar($'B');
156
157 pos = slider1 + 120;
158 gfx_r = gfx_g = 0.1;
159 gfx_b = 0.9;
160 dB = 20 * log10(gainR);
161 dB *= -1;
162 pos == 0 ? dB = 99.9;
163 m == 0 ? dB = 99.9;
164 y = y_step*dB/3 + y_step;
165 y > y_step*7 - 1 ? y = y_step*7 - 1;
166 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
167 gfx_rect(x_step+pos/240*x_step*8, y_step+2, 1, y_step*6-3, 0.5);// vertical line
168 gfx_rect(x_step+pos/240*x_step*8-3, y-2, 7, 6, 0.5); // hilite box
169 gfx_x = gfx_w*.9+8;
170 gfx_y = y-6;
171 sprintf(str, "%.1fdB", -dB);
172 gfx_drawstr(str);
173 gfx_x = x_step+pos/240*x_step*8-9;
174 gfx_y = y_step - 17;
175 sprintf(str, "%.1f˚", slider1);
176 gfx_drawstr(str);
177
178 gfx_g = 0.2;
179 gfx_b = gfx_r = 0.9;
180 RES = 100; // min = 8
181 x_step1 = x_step * 8/RES;
182
183 i = 1;
184 loop(RES, //8, // main curve
185 x = i*x_step1;
186
187 c=(240*(i-1)/RES)-120;
188 m1 = c + 120;
189 m1 *= 90/240;
190 gainR1 = pow(sin( m1 * $pi / 180.0 ), 2);
191 dB1 = -20 * log10(gainR1);
192 dB1 > 18 ? dB1 = 18;
193 i == 1 ? dB1 = 18;
194 y = y_step*dB1/3 + y_step;
195
196 c=(240*(i)/RES)-120;
197 m2 = c + 120;
198 m2 *= 90/240;
199 gainR2 = pow(sin( m2 * $pi / 180.0 ), 2);
200 dB2 = -20 * log10(gainR2);
201 dB2 > 18 ? dB2 = 18;
202 i == 1 ? dB2 = 18;
203 y1 = y_step*dB2 /3 + y_step;
204
205 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
206 i += 1;
207 );
208
209 gfx_setfont(1, "Arial", 12); // main title
210 gfx_r = gfx_g = gfx_b = 0.0;
211 gfx_x = x_step;
212 gfx_y = gfx_h - y_step - 7;
213 gfx_drawstr("Cos -6dB Pan: Gain (dB) - vs - Pan Angle (degrees)");
214
215 // mouse
216 mouse_cap == 1 ? (
217 xx = mouse_x;
218 xx > gfx_w * 0.1 ? (
219 xx < gfx_w * 0.9 ? (
220 yy = mouse_y;
221 yy > gfx_h * 0.1 ? (
222 yy < gfx_h * 0.7 ? (
223 slider1 = 240 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1) - 120;
224 // slider1 < 0.3 ? slider1 = floor(slider1);
225 // slider1 > 99.7 ? slider1 = ceil(slider1);
226 slider1 = floor(slider1*10);
227 slider1 /= 10;
228 sliderchange(slider1);
229 slider_automate(slider1);
230 slider1 < -119 ? slider1 = -120;
231 slider1 > 119 ? slider1 = 120;
232 m = slider1 + 120;
233 m *= 90/240;
234 gainL = pow(cos( m * $pi / 180.0 ), 2);
235 gainR = pow(sin( m * $pi / 180.0 ), 2);
236 );
237 );
238 );
239 );
240 );
Pan, Linear [-6dB]
00 /**********************************************************************
01 Copyright (c) 2014-2016 Mark C. Erickson
02
03 Permission is hereby granted, free of charge, to any person obtaining
04 a copy of this software and associated documentation files (the
05 "Software"), to deal in the Software without restriction, including
06 without limitation the rights to use, copy, modify, merge, publish,
07 distribute, sublicense, and/or sell copies of the Software, and to
08 permit persons to whom the Software is furnished to do so, subject to
09 the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - added GUI
24 v1.0.0 - initial release
25
26 **********************************************************************/
27
Disclaimer...
28 desc:Pan: Linear [-6dB], v1.1.0
29
30 slider1:0<-120,120,0.1>Pan Angle [degrees]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 m = 0.5;
35
36 @slider
37 m = (120 + slider1) / 240.0;
38
39 @sample
40 spl1 *= m;
41 x = 1.0 - m;
42 spl0 *= x;
43
Graphics...
45 @gfx 256 256
46 gfx_setfont(1, "Arial", 10);
47 gfx_a = 1;
48
49 gfx_r = gfx_g = gfx_b = 0.1;
50 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
51 gfx_line(0, 0, 0, gfx_h, 0.5);
52 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
53 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
54
55 x_step = gfx_w / 10;
56 y_step = gfx_h / 10;
57
58 i = 1;
59 loop(9, // y-axiis
60 x = i*x_step;
61 gfx_line(x, y_step, x, y_step*7, 0.5);
62 i += 1;
63 );
64
65 gfx_x = x_step - 15;
66 gfx_y = gfx_h - 3*y_step + 9;
67 sprintf(str, "%.1f˚", -120);
68 gfx_drawstr(str);
69
70 gfx_x = 3*x_step - 11;
71 gfx_y = gfx_h - 3*y_step + 9;
72 sprintf(str, "%.1f˚", -60);
73 gfx_drawstr(str);
74
75 gfx_x = 5*x_step - 7;
76 gfx_y = gfx_h - 3*y_step + 9;
77 sprintf(str, "%.1f˚", 0);
78 gfx_drawstr(str);
79
80 gfx_x = 7*x_step - 11;
81 gfx_y = gfx_h - 3*y_step + 9;
82 sprintf(str, "+%.1f˚", 60);
83 gfx_drawstr(str);
84
85 gfx_x = 9*x_step - 15;
86 gfx_y = gfx_h - 3*y_step + 9;
87 sprintf(str, "+%.1f˚", 120);
88 gfx_drawstr(str);
89
90 i = 1;
91 loop(7, // x-axiis
92 y = i*y_step;
93 gfx_line(x_step-2, y, x_step*9, y, 0.5);
94 i += 1;
95 );
96
97 gfx_x = x_step - 32;
98 gfx_y = y_step - 6;
99 gfx_drawchar($' ');
100 gfx_drawchar($'0');
101 gfx_drawchar($' ');
102 gfx_drawchar($'d');
103 gfx_drawchar($'B');
104
105 gfx_x = x_step - 33;
106 gfx_y = 2*y_step - 7;
107 gfx_drawchar($'-');
108 gfx_drawchar($' ');
109 gfx_drawchar($'3');
110 gfx_drawchar($'d');
111 gfx_drawchar($'B');
112
113 gfx_x = x_step - 33;
114 gfx_y = 3*y_step - 7;
115 gfx_drawchar($'-');
116 gfx_drawchar($' ');
117 gfx_drawchar($'6');
118 gfx_drawchar($'d');
119 gfx_drawchar($'B');
120
121 gfx_x = x_step - 33;
122 gfx_y = 4*y_step - 7;
123 gfx_drawchar($'-');
124 gfx_drawchar($' ');
125 gfx_drawchar($'9');
126 gfx_drawchar($'d');
127 gfx_drawchar($'B');
128
129 gfx_x = x_step - 36;
130 gfx_y = 5*y_step - 7;
131 gfx_drawchar($'-');
132 gfx_drawchar($'1');
133 gfx_drawchar($'2');
134 gfx_drawchar($'d');
135 gfx_drawchar($'B');
136
137 gfx_x = x_step - 36;
138 gfx_y = 6*y_step - 7;
139 gfx_drawchar($'-');
140 gfx_drawchar($'1');
141 gfx_drawchar($'5');
142 gfx_drawchar($'d');
143 gfx_drawchar($'B');
144
145 gfx_x = x_step - 36;
146 gfx_y = 7*y_step - 7;
147 gfx_drawchar($'-');
148 gfx_drawchar($'1');
149 gfx_drawchar($'8');
150 gfx_drawchar($'d');
151 gfx_drawchar($'B');
152
153 pos = slider1 + 120;
154 gfx_r = gfx_g = 0.1;
155 gfx_b = 0.9;
156 dB = 20 * log10(m);
157 dB *= -1;
158 pos == 0 ? dB = 99.9;
159 m == 0 ? dB = 99.9;
160 y = y_step*dB/3 + y_step;
161 y > y_step*7 - 1 ? y = y_step*7 - 1;
162 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
163 gfx_rect(x_step+pos/240*x_step*8, y_step+2, 1, y_step*6-3, 0.5);// vertical line
164 gfx_rect(x_step+pos/240*x_step*8-3, y-2, 7, 6, 0.5); // hilite box
165 gfx_x = gfx_w*.9+8;
166 gfx_y = y-6;
167 sprintf(str, "%.1fdB", -dB);
168 gfx_drawstr(str);
169 gfx_x = x_step+pos/240*x_step*8-9;
170 gfx_y = y_step - 17;
171 sprintf(str, "%.1f˚", slider1);
172 gfx_drawstr(str);
173
174 gfx_g = 0.2;
175 gfx_b = gfx_r = 0.9;
176 RES = 100; // min = 8
177 x_step1 = x_step * 8/RES;
178
179 i = 1;
180 loop(RES, //8, // main curve
181 x = i*x_step1;
182
183 c=(240*(i-1)/RES)-120;
184 m1 = (120 + c) / 240.0;
185 dB1 = -20 * log10(m1);
186 dB1 > 18 ? dB1 = 18;
187 i == 1 ? dB1 = 18;
188 y = y_step*dB1/3 + y_step;
189
190 c=(240*(i)/RES)-120;
191 m2 = (120 + c) / 240.0;
192 dB2 = -20 * log10(m2);
193 dB2 > 18 ? dB2 = 18;
194 i == 1 ? dB2 = 18;
195 y1 = y_step*dB2 /3 + y_step;
196
197 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
198 i += 1;
199 );
200
201 gfx_setfont(1, "Arial", 12); // main title
202 gfx_r = gfx_g = gfx_b = 0.0;
203 gfx_x = x_step;
204 gfx_y = gfx_h - y_step - 7;
205 gfx_drawstr("Linear Pan: Gain (dB) - vs - Pan Angle (degrees)");
206
207 // mouse
208 mouse_cap == 1 ? (
209 xx = mouse_x;
210 xx > gfx_w * 0.1 ? (
211 xx < gfx_w * 0.9 ? (
212 yy = mouse_y;
213 yy > gfx_h * 0.1 ? (
214 yy < gfx_h * 0.7 ? (
215 slider1 = 240 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1) - 120;
216 // slider1 < 0.3 ? slider1 = floor(slider1);
217 // slider1 > 99.7 ? slider1 = ceil(slider1);
218 slider1 = floor(slider1*10);
219 slider1 /= 10;
220 sliderchange(slider1);
221 slider_automate(slider1);
222 m = (120 + slider1) / 240.0;
223 slider1 < -119 ? ( m = 0.0; slider1 = -120; );
224 slider1 > 119 ? ( m = 1.0; slider1 = 120; );
225 );
226 );
227 );
228 );
229 );
230
231