Category Archives: Faders
Fader, LOG [+0db]
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:Fader: LOG [+0dB], v1.1.0
29
30 slider1:86.1<0,100,.1>Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 x = 0.861;
35 m = 0.5;
36
37 @slider
38 x = slider1/100.0; // 0 < m < 1.0, effectively 0-100%
39 z = (sqrt(x) * 84) - 84;
40 m = pow( 10, z / 20.0 );
41
42 @sample
43 spl0 *= m;
44 spl1 *= m;
45
46
Graphics...
48 @gfx 256 256
49 gfx_setfont(1, "Arial", 10);
50 gfx_a = 1;
51
52 gfx_r = gfx_g = gfx_b = 0.1;
53 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
54 gfx_line(0, 0, 0, gfx_h, 0.5);
55 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
56 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
57
58 x_step = gfx_w / 10;
59 y_step = gfx_h / 10;
60
61 i = 1;
62 loop(9, // y-axiis
63 x = i*x_step;
64 gfx_line(x, y_step, x, y_step*8, 0.5);
65 i += 1;
66 );
67
68 gfx_x = x_step - 2;
69 gfx_y = gfx_h - 2*y_step + 9;
70 gfx_drawchar($'0');
71 gfx_drawchar($'m');gfx_drawchar($'m');
72
73 gfx_x = 3*x_step - 7;
74 gfx_y = gfx_h - 2*y_step + 9;
75 gfx_drawchar($'2');
76 gfx_drawchar($'5');
77 gfx_drawchar($'m');gfx_drawchar($'m');
78
79 gfx_x = 5*x_step - 7;
80 gfx_y = gfx_h - 2*y_step + 9;
81 gfx_drawchar($'5');
82 gfx_drawchar($'0');
83 gfx_drawchar($'m');gfx_drawchar($'m');
84
85 gfx_x = 7*x_step - 7;
86 gfx_y = gfx_h - 2*y_step + 9;
87 gfx_drawchar($'7');
88 gfx_drawchar($'5');
89 gfx_drawchar($'m');gfx_drawchar($'m');
90
91 gfx_x = 9*x_step - 12;
92 gfx_y = gfx_h - 2*y_step + 9;
93 gfx_drawchar($'1');
94 gfx_drawchar($'0');
95 gfx_drawchar($'0');
96 gfx_drawchar($'m');gfx_drawchar($'m');
97
98 i = 1;
99 loop(8, // x-axiis
100 y = i*y_step;
101 gfx_line(x_step-2, y, x_step*9, y, 0.5);
102 i += 1;
103 );
104
105 gfx_x = x_step - 32;
106 gfx_y = y_step - 6;
107 gfx_drawchar($' ');
108 gfx_drawchar($'0');
109 gfx_drawchar($' ');
110 gfx_drawchar($'d');
111 gfx_drawchar($'B');
112
113 gfx_x = x_step - 36;
114 gfx_y = 2*y_step - 7;
115 gfx_drawchar($'-');
116 gfx_drawchar($'1');
117 gfx_drawchar($'2');
118 gfx_drawchar($'d');
119 gfx_drawchar($'B');
120
121 gfx_x = x_step - 36;
122 gfx_y = 3*y_step - 7;
123 gfx_drawchar($'-');
124 gfx_drawchar($'2');
125 gfx_drawchar($'4');
126 gfx_drawchar($'d');
127 gfx_drawchar($'B');
128
129 gfx_x = x_step - 36;
130 gfx_y = 4*y_step - 7;
131 gfx_drawchar($'-');
132 gfx_drawchar($'3');
133 gfx_drawchar($'6');
134 gfx_drawchar($'d');
135 gfx_drawchar($'B');
136
137 gfx_x = x_step - 36;
138 gfx_y = 5*y_step - 7;
139 gfx_drawchar($'-');
140 gfx_drawchar($'4');
141 gfx_drawchar($'8');
142 gfx_drawchar($'d');
143 gfx_drawchar($'B');
144
145 gfx_x = x_step - 36;
146 gfx_y = 6*y_step - 7;
147 gfx_drawchar($'-');
148 gfx_drawchar($'6');
149 gfx_drawchar($'0');
150 gfx_drawchar($'d');
151 gfx_drawchar($'B');
152
153 gfx_x = x_step - 36;
154 gfx_y = 7*y_step - 7;
155 gfx_drawchar($'-');
156 gfx_drawchar($'7');
157 gfx_drawchar($'2');
158 gfx_drawchar($'d');
159 gfx_drawchar($'B');
160
161 gfx_x = x_step - 36;
162 gfx_y = 8*y_step - 8;
163 gfx_drawchar($'-');
164 gfx_drawchar($'8');
165 gfx_drawchar($'4');
166 gfx_drawchar($'d');
167 gfx_drawchar($'B');
168
169 gfx_r = gfx_g = 0.2;
170 gfx_b = 0.9;
171 dB = 20 * log10(m);
172 dB *= -1;
173 dB > 83 ? dB = 84;
174 m == 0? dB = 84;
175 y = y_step*dB/12 + y_step;
176 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
177 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
178 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
179 gfx_x = gfx_w*.9+8;
180 gfx_y = y-6;
181 sprintf(str, "%.1fdB", -dB);
182 gfx_drawstr(str);
183 gfx_x = x_step+slider1/100*x_step*8-9;
184 gfx_y = y_step - 17;
185 sprintf(str, "%.1fmm", slider1);
186 gfx_drawstr(str);
187
188 gfx_g = 0.1;
189 gfx_b = gfx_r = 0.9;
190 RES = 100; // min = 8
191 x_step1 = x_step * 8/RES;
192
193 i = 1;
194 loop(RES, //8, // main curve
195 x = i*x_step1;
196 dB = (sqrt((i-1)/RES) * 84) - 84;
197 dB *= -1;
198 dB > 83 ? dB = 84;
199 i == 1? dB = 84;
200 y = y_step*dB/12 + y_step;
201
202 dB1 = (sqrt((i)/RES) * 84) - 84;
203 dB1 *= -1;
204 dB1 > 83 ? dB1 = 84;
205 i == 1 ? dB = 84;
206 y1 = y_step*dB1/12 + y_step;
207
208 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
209 i += 1;
210 );
211
212 gfx_setfont(1, "Arial", 12); // main title
213 gfx_r = gfx_g = gfx_b = 0.0;
214 gfx_x = x_step;
215 gfx_y = gfx_h - y_step + 3;
216 gfx_drawstr("LOG Fader: Gain (dB) - vs - Fader Travel (mm)");
217
218 // mouse
219 mouse_cap == 1 ? (
220 xx = mouse_x;
221 xx > gfx_w * 0.1 ? (
222 xx < gfx_w * 0.9 ? (
223 yy = mouse_y;
224 yy > gfx_h * 0.1 ? (
225 yy < gfx_h * 0.8 ? (
226 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
227 slider1 < 0.3 ? slider1 = floor(slider1);
228 slider1 > 99.7 ? slider1 = ceil(slider1);
229 slider1 = floor(slider1*10);
230 slider1 /= 10;
231 sliderchange(slider1);
232 slider_automate(slider1);
233 x = slider1/100.0; // 0 < m < 1.0, effectively 0-100%
234 z = (sqrt(x) * 84) - 84;
235 m = pow( 10, z / 20.0 );
236 )
237 );
238 );
239 );
240 );
241
242
Fader, LOG [+12dB]
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:Fader: LOG [+12dB], v1.1.0
29
30 slider1:73.4<0,100,.1>Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 x = 0.734;
35 m = 1;
36
37 @slider
38 x = slider1/100.0; // 0 < m < 1.0, effectively 0-100%
39 z = (sqrt(x) * 84) - 72;
40 m = pow( 10, z / 20.0 );
41
42 @sample
43 spl0 *= m;
44 spl1 *= m;
45
46
Graphics...
48 @gfx 256 256
49 gfx_setfont(1, "Arial", 10);
50 gfx_a = 1;
51
52 gfx_r = gfx_g = gfx_b = 0.1;
53 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
54 gfx_line(0, 0, 0, gfx_h, 0.5);
55 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
56 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
57
58 x_step = gfx_w / 10;
59 y_step = gfx_h / 10;
60
61 i = 1;
62 loop(9, // y-axiis
63 x = i*x_step;
64 gfx_line(x, y_step, x, y_step*8, 0.5);
65 i += 1;
66 );
67
68 gfx_x = x_step - 2;
69 gfx_y = gfx_h - 2*y_step + 9;
70 gfx_drawchar($'0');
71 gfx_drawchar($'m');
72 gfx_drawchar($'m');
73
74 gfx_x = 3*x_step - 7;
75 gfx_y = gfx_h - 2*y_step + 9;
76 gfx_drawchar($'2');
77 gfx_drawchar($'5');
78 gfx_drawchar($'m');
79 gfx_drawchar($'m');
80
81 gfx_x = 5*x_step - 7;
82 gfx_y = gfx_h - 2*y_step + 9;
83 gfx_drawchar($'5');
84 gfx_drawchar($'0');
85 gfx_drawchar($'m');
86 gfx_drawchar($'m');
87
88 gfx_x = 7*x_step - 7;
89 gfx_y = gfx_h - 2*y_step + 9;
90 gfx_drawchar($'7');
91 gfx_drawchar($'5');
92 gfx_drawchar($'m');
93 gfx_drawchar($'m');
94
95 gfx_x = 9*x_step - 12;
96 gfx_y = gfx_h - 2*y_step + 9;
97 gfx_drawchar($'1');
98 gfx_drawchar($'0');
99 gfx_drawchar($'0');
100 gfx_drawchar($'m');
101 gfx_drawchar($'m');
102
103 i = 1;
104 loop(8, // x-axiis
105 y = i*y_step;
106 gfx_line(x_step-2, y, x_step*9, y, 0.5);
107 i += 1;
108 );
109
110 gfx_x = x_step - 36;
111 gfx_y = y_step - 6;
112 gfx_drawchar($'+');
113 gfx_drawchar($'1');
114 gfx_drawchar($'2');
115 gfx_drawchar($'d');
116 gfx_drawchar($'B');
117
118 gfx_x = x_step - 32;
119 gfx_y = 2*y_step - 7;
120 gfx_drawchar($' ');
121 gfx_drawchar($'0');
122 gfx_drawchar($' ');
123 gfx_drawchar($'d');
124 gfx_drawchar($'B');
125
126 gfx_x = x_step - 36;
127 gfx_y = 3*y_step - 7;
128 gfx_drawchar($'-');
129 gfx_drawchar($'1');
130 gfx_drawchar($'2');
131 gfx_drawchar($'d');
132 gfx_drawchar($'B');
133
134 gfx_x = x_step - 36;
135 gfx_y = 4*y_step - 7;
136 gfx_drawchar($'-');
137 gfx_drawchar($'2');
138 gfx_drawchar($'4');
139 gfx_drawchar($'d');
140 gfx_drawchar($'B');
141
142 gfx_x = x_step - 36;
143 gfx_y = 5*y_step - 7;
144 gfx_drawchar($'-');
145 gfx_drawchar($'3');
146 gfx_drawchar($'6');
147 gfx_drawchar($'d');
148 gfx_drawchar($'B');
149
150 gfx_x = x_step - 36;
151 gfx_y = 6*y_step - 7;
152 gfx_drawchar($'-');
153 gfx_drawchar($'4');
154 gfx_drawchar($'8');
155 gfx_drawchar($'d');
156 gfx_drawchar($'B');
157
158 gfx_x = x_step - 36;
159 gfx_y = 7*y_step - 7;
160 gfx_drawchar($'-');
161 gfx_drawchar($'6');
162 gfx_drawchar($'0');
163 gfx_drawchar($'d');
164 gfx_drawchar($'B');
165
166 gfx_x = x_step - 36;
167 gfx_y = 8*y_step - 8;
168 gfx_drawchar($'-');
169 gfx_drawchar($'7');
170 gfx_drawchar($'2');
171 gfx_drawchar($'d');
172 gfx_drawchar($'B');
173
174 gfx_r = gfx_g = 0.2;
175 gfx_b = 0.9;
176 m1 = m/3.981071705534972;
177 dB = 20 * log10(m1);
178 dB *= -1;
179 dB > 83 ? dB = 84;
180 m == 0? dB = 84;
181 y = y_step*dB/12 + y_step;
182 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
183 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
184 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
185 gfx_x = gfx_w*.9+8;
186 gfx_y = y-6;
187 sprintf(str, "%.1fdB", -dB+12);
188 gfx_drawstr(str);
189 gfx_x = x_step+slider1/100*x_step*8-3;
190 gfx_y = y_step - 17;
191 sprintf(str, "%.1fmm", slider1);
192 gfx_drawstr(str);
193
194 gfx_g = 0.1;
195 gfx_b = gfx_r = 0.9;
196 RES = 100; // min = 8
197 x_step1 = x_step * 8/RES;
198
199 i = 1;
200 loop(RES, //8, // main curve
201 x = i*x_step1;
202 dB = (sqrt((i-1)/RES) * 84) - 84;
203 dB *= -1;
204 dB > 83 ? dB = 84;
205 i == 1? dB = 84;
206 y = y_step*dB/12 + y_step;
207
208 dB1 = (sqrt((i)/RES) * 84) - 84;
209 dB1 *= -1;
210 dB1 > 83 ? dB1 = 84;
211 i == 1 ? dB = 84;
212 y1 = y_step*dB1/12 + y_step;
213
214 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
215 i += 1;
216 );
217
218 gfx_setfont(1, "Arial", 12); // main title
219 gfx_r = gfx_g = gfx_b = 0.0;
220 gfx_x = x_step;
221 gfx_y = gfx_h - y_step + 3;
222 gfx_drawstr("LOG Fader: Gain (dB) - vs - Fader Travel (mm)");
223
224 // mouse
225 mouse_cap == 1 ? (
226 xx = mouse_x;
227 xx > gfx_w * 0.1 ? (
228 xx < gfx_w * 0.9 ? (
229 yy = mouse_y;
230 yy > gfx_h * 0.1 ? (
231 yy < gfx_h * 0.8 ? (
232 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
233 slider1 < 0.3 ? slider1 = floor(slider1);
234 slider1 > 99.7 ? slider1 = ceil(slider1);
235 slider1 = floor(slider1*10);
236 slider1 /= 10;
237 sliderchange(slider1);
238 slider_automate(slider1);
239 x = slider1/100.0; // 0 < m < 1.0, effectively 0-100%
240 z = (sqrt(x) * 84) - 72;
241 m = pow( 10, z / 20.0 );
242 )
243 );
244 );
245 );
246 );
247
248
Fader, Parallel Squared [+12dB]
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 MERCHANT-
16 ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO
17 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20 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:Fader: Parallel Squared [+12dB], v1.1.0
29
30 slider1: 74.4 <0, 100, 0.1> Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 factor = 4700.0 / 12000.0;
35 m = 1;
36
37 @slider
38 c = slider1 / 100.0;
39 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
40 m = 3.981071705534972 * d * d;
41
42 @sample
43 spl0 *= m;
44 spl1 *= m;
45
46
Graphics...
48 @gfx 256 256
49 gfx_setfont(1, "Arial", 10);
50 gfx_a = 1;
51
52 gfx_r = gfx_g = gfx_b = 0.1;
53 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
54 gfx_line(0, 0, 0, gfx_h, 0.5);
55 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
56 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
57
58 x_step = gfx_w / 10;
59 y_step = gfx_h / 10;
60
61 i = 1;
62 loop(9, // y-axiis
63 x = i*x_step;
64 gfx_line(x, y_step, x, y_step*8, 0.5);
65 i += 1;
66 );
67
68 gfx_x = x_step - 2;
69 gfx_y = gfx_h - 2*y_step + 9;
70 gfx_drawchar($'0');
71 gfx_drawchar($'m');
72 gfx_drawchar($'m');
73
74 gfx_x = 3*x_step - 7;
75 gfx_y = gfx_h - 2*y_step + 9;
76 gfx_drawchar($'2');
77 gfx_drawchar($'5');
78 gfx_drawchar($'m');
79 gfx_drawchar($'m');
80
81 gfx_x = 5*x_step - 7;
82 gfx_y = gfx_h - 2*y_step + 9;
83 gfx_drawchar($'5');
84 gfx_drawchar($'0');
85 gfx_drawchar($'m');
86 gfx_drawchar($'m');
87
88 gfx_x = 7*x_step - 7;
89 gfx_y = gfx_h - 2*y_step + 9;
90 gfx_drawchar($'7');
91 gfx_drawchar($'5');
92 gfx_drawchar($'m');
93 gfx_drawchar($'m');
94
95 gfx_x = 9*x_step - 12;
96 gfx_y = gfx_h - 2*y_step + 9;
97 gfx_drawchar($'1');
98 gfx_drawchar($'0');
99 gfx_drawchar($'0');
100 gfx_drawchar($'m');
101 gfx_drawchar($'m');
102
103 i = 1;
104 loop(8, // x-axiis
105 y = i*y_step;
106 gfx_line(x_step-2, y, x_step*9, y, 0.5);
107 i += 1;
108 );
109
110 gfx_x = x_step - 36;
111 gfx_y = y_step - 6;
112 gfx_drawchar($'+');
113 gfx_drawchar($'1');
114 gfx_drawchar($'2');
115 gfx_drawchar($'d');
116 gfx_drawchar($'B');
117
118 gfx_x = x_step - 32;
119 gfx_y = 2*y_step - 7;
120 gfx_drawchar($' ');
121 gfx_drawchar($'0');
122 gfx_drawchar($' ');
123 gfx_drawchar($'d');
124 gfx_drawchar($'B');
125
126 gfx_x = x_step - 36;
127 gfx_y = 3*y_step - 7;
128 gfx_drawchar($'-');
129 gfx_drawchar($'1');
130 gfx_drawchar($'2');
131 gfx_drawchar($'d');
132 gfx_drawchar($'B');
133
134 gfx_x = x_step - 36;
135 gfx_y = 4*y_step - 7;
136 gfx_drawchar($'-');
137 gfx_drawchar($'2');
138 gfx_drawchar($'4');
139 gfx_drawchar($'d');
140 gfx_drawchar($'B');
141
142 gfx_x = x_step - 36;
143 gfx_y = 5*y_step - 7;
144 gfx_drawchar($'-');
145 gfx_drawchar($'3');
146 gfx_drawchar($'6');
147 gfx_drawchar($'d');
148 gfx_drawchar($'B');
149
150 gfx_x = x_step - 36;
151 gfx_y = 6*y_step - 7;
152 gfx_drawchar($'-');
153 gfx_drawchar($'4');
154 gfx_drawchar($'8');
155 gfx_drawchar($'d');
156 gfx_drawchar($'B');
157
158 gfx_x = x_step - 36;
159 gfx_y = 7*y_step - 7;
160 gfx_drawchar($'-');
161 gfx_drawchar($'6');
162 gfx_drawchar($'0');
163 gfx_drawchar($'d');
164 gfx_drawchar($'B');
165
166 gfx_x = x_step - 36;
167 gfx_y = 8*y_step - 8;
168 gfx_drawchar($'-');
169 gfx_drawchar($'7');
170 gfx_drawchar($'2');
171 gfx_drawchar($'d');
172 gfx_drawchar($'B');
173
174 gfx_r = gfx_g = 0.2;
175 gfx_b = 0.9;
176 m1 = m/3.981071705534972;
177 dB = 20 * log10(m1);
178 dB *= -1;
179 dB > 83 ? dB = 84;
180 m == 0? dB = 84;
181 y = y_step*dB/12 + y_step;
182 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
183 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
184 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
185 gfx_x = gfx_w*.9+8;
186 gfx_y = y-6;
187 sprintf(str, "%.1fdB", -dB+12);
188 gfx_drawstr(str);
189 gfx_x = x_step+slider1/100*x_step*8-3;
190 gfx_y = y_step - 17;
191 sprintf(str, "%.1fmm", slider1);
192 gfx_drawstr(str);
193
194 gfx_g = 0.1;
195 gfx_b = gfx_r = 0.9;
196 RES = 100; // min = 8
197 x_step1 = x_step * 8/RES;
198
199 i = 1;
200 loop(RES, //8, // main curve
201 x = i*x_step1;
202 c=(i-1)/RES;
203 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
204 m1 = d * d;
205 dB = -20 * log10(m1); dB > 83 ? dB = 84;
206 i == 1? dB = 84;
207 y = y_step*dB/12 + y_step;
208
209 c=(i)/RES;
210 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
211 m2 = d * d;
212 dB1 = -20 * log10(m2);
213 dB1 > 83 ? dB1 = 84;
214 i == 1 ? dB = 84;
215 y1 = y_step*dB1/12 + y_step;
216
217 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
218 i += 1;
219 );
220
221 gfx_setfont(1, "Arial", 12); // main title
222 gfx_r = gfx_g = gfx_b = 0.0;
223 gfx_x = x_step;
224 gfx_y = gfx_h - y_step + 3;
225 gfx_drawstr("Parallel Squared Fader: Gain (dB) - vs - Fader Travel (mm)");
226
227 // mouse
228 mouse_cap == 1 ? (
229 xx = mouse_x;
230 xx > gfx_w * 0.1 ? (
231 xx < gfx_w * 0.9 ? (
232 yy = mouse_y;
233 yy > gfx_h * 0.1 ? (
234 yy < gfx_h * 0.8 ? (
235 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
236 slider1 < 0.3 ? slider1 = floor(slider1);
237 slider1 > 99.7 ? slider1 = ceil(slider1);
238 slider1 = floor(slider1*10);
239 slider1 /= 10;
240 sliderchange(slider1);
241 slider_automate(slider1);
242 c = slider1/100;
243 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
244 m = 3.981071705534972 * d * d;
245 )
246 );
247 );
248 );
249 );
250
251
Fader, Parallel Squared [+0dB]
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 MERCHANT-
16 ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO
17 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20 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:Fader: Parallel Squared [+0dB], v1.1.0
29
30 slider1: 82.6 <0, 100, 0.1> Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 factor = 10000.0 / 12000.0;
35 m = 0.5;
36
37 @slider
38 c = slider1 / 100.0;
39 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
40 m = d * d;
41
42 @sample
43 spl0 *= m;
44 spl1 *= m;
45
46
Graphics...
48 @gfx 256 256
49 gfx_setfont(1, "Arial", 10);
50 gfx_a = 1;
51
52 gfx_r = gfx_g = gfx_b = 0.1;
53 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
54 gfx_line(0, 0, 0, gfx_h, 0.5);
55 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
56 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
57
58 x_step = gfx_w / 10;
59 y_step = gfx_h / 10;
60
61 i = 1;
62 loop(9, // y-axiis
63 x = i*x_step;
64 gfx_line(x, y_step, x, y_step*8, 0.5);
65 i += 1;
66 );
67
68 gfx_x = x_step - 2;
69 gfx_y = gfx_h - 2*y_step + 9;
70 gfx_drawchar($'0');
71 gfx_drawchar($'m');gfx_drawchar($'m');
72
73 gfx_x = 3*x_step - 7;
74 gfx_y = gfx_h - 2*y_step + 9;
75 gfx_drawchar($'2');
76 gfx_drawchar($'5');
77 gfx_drawchar($'m');gfx_drawchar($'m');
78
79 gfx_x = 5*x_step - 7;
80 gfx_y = gfx_h - 2*y_step + 9;
81 gfx_drawchar($'5');
82 gfx_drawchar($'0');
83 gfx_drawchar($'m');gfx_drawchar($'m');
84
85 gfx_x = 7*x_step - 7;
86 gfx_y = gfx_h - 2*y_step + 9;
87 gfx_drawchar($'7');
88 gfx_drawchar($'5');
89 gfx_drawchar($'m');gfx_drawchar($'m');
90
91 gfx_x = 9*x_step - 12;
92 gfx_y = gfx_h - 2*y_step + 9;
93 gfx_drawchar($'1');
94 gfx_drawchar($'0');
95 gfx_drawchar($'0');
96 gfx_drawchar($'m');gfx_drawchar($'m');
97
98 i = 1;
99 loop(8, // x-axiis
100 y = i*y_step;
101 gfx_line(x_step-2, y, x_step*9, y, 0.5);
102 i += 1;
103 );
104
105 gfx_x = x_step - 32;
106 gfx_y = y_step - 6;
107 gfx_drawchar($' ');
108 gfx_drawchar($'0');
109 gfx_drawchar($' ');
110 gfx_drawchar($'d');
111 gfx_drawchar($'B');
112
113 gfx_x = x_step - 36;
114 gfx_y = 2*y_step - 7;
115 gfx_drawchar($'-');
116 gfx_drawchar($'1');
117 gfx_drawchar($'2');
118 gfx_drawchar($'d');
119 gfx_drawchar($'B');
120
121 gfx_x = x_step - 36;
122 gfx_y = 3*y_step - 7;
123 gfx_drawchar($'-');
124 gfx_drawchar($'2');
125 gfx_drawchar($'4');
126 gfx_drawchar($'d');
127 gfx_drawchar($'B');
128
129 gfx_x = x_step - 36;
130 gfx_y = 4*y_step - 7;
131 gfx_drawchar($'-');
132 gfx_drawchar($'3');
133 gfx_drawchar($'6');
134 gfx_drawchar($'d');
135 gfx_drawchar($'B');
136
137 gfx_x = x_step - 36;
138 gfx_y = 5*y_step - 7;
139 gfx_drawchar($'-');
140 gfx_drawchar($'4');
141 gfx_drawchar($'8');
142 gfx_drawchar($'d');
143 gfx_drawchar($'B');
144
145 gfx_x = x_step - 36;
146 gfx_y = 6*y_step - 7;
147 gfx_drawchar($'-');
148 gfx_drawchar($'6');
149 gfx_drawchar($'0');
150 gfx_drawchar($'d');
151 gfx_drawchar($'B');
152
153 gfx_x = x_step - 36;
154 gfx_y = 7*y_step - 7;
155 gfx_drawchar($'-');
156 gfx_drawchar($'7');
157 gfx_drawchar($'2');
158 gfx_drawchar($'d');
159 gfx_drawchar($'B');
160
161 gfx_x = x_step - 36;
162 gfx_y = 8*y_step - 8;
163 gfx_drawchar($'-');
164 gfx_drawchar($'8');
165 gfx_drawchar($'4');
166 gfx_drawchar($'d');
167 gfx_drawchar($'B');
168
169 gfx_r = gfx_g = 0.1;
170 gfx_b = 0.9;
171 dB = 20 * log10(m);
172 dB *= -1;
173 dB > 83 ? dB = 84;
174 m == 0? dB = 84;
175 y = y_step*dB/12 + y_step;
176 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
177 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
178 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
179 gfx_x = gfx_w*.9+8;
180 gfx_y = y-6;
181 sprintf(str, "%.1fdB", -dB);
182 gfx_drawstr(str);
183 gfx_x = x_step+slider1/100*x_step*8-9;
184 gfx_y = y_step - 17;
185 sprintf(str, "%.1fmm", slider1);
186 gfx_drawstr(str);
187
188 gfx_g = 0.2;
189 gfx_b = gfx_r = 0.9;
190 RES = 100; // min = 8
191 x_step1 = x_step * 8/RES;
192
193 i = 1;
194 loop(RES, //8, // main curve
195 x = i*x_step1;
196 c=(i-1)/RES;
197 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
198 m1 = d * d;
199 dB = -20 * log10(m1);
200 dB > 83 ? dB = 84;
201 i == 1? dB = 84;
202 y = y_step*dB/12 + y_step;
203
204 c=(i)/RES;
205 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
206 m2 = d * d;
207 dB1 = -20 * log10(m2);
208 dB1 > 83 ? dB1 = 84;
209 i == 1 ? dB = 84;
210 y1 = y_step*dB1/12 + y_step;
211
212 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
213 i += 1;
214 );
215
216 gfx_setfont(1, "Arial", 12); // main title
217 gfx_r = gfx_g = gfx_b = 0.0;
218 gfx_x = x_step;
219 gfx_y = gfx_h - y_step + 3;
220 gfx_drawstr("Parallel Squared Fader: Gain (dB) - vs - Fader Travel (mm)");
221
222 // mouse
223 mouse_cap == 1 ? (
224 xx = mouse_x;
225 xx > gfx_w * 0.1 ? (
226 xx < gfx_w * 0.9 ? (
227 yy = mouse_y;
228 yy > gfx_h * 0.1 ? (
229 yy < gfx_h * 0.8 ? (
230 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
231 slider1 < 0.3 ? slider1 = floor(slider1);
232 slider1 > 99.7 ? slider1 = ceil(slider1);
233 slider1 = floor(slider1*10);
234 slider1 /= 10;
235 sliderchange(slider1);
236 slider_automate(slider1);
237 c= slider1/100;
238 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
239 m = d * d;
240 );
241 );
242 );
243 );
244 );
245
246
Fader, Squared [+12dB]
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 MERCHANT-
16 ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO
17 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20 THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 CHANGE LOG:
23 v1.1.0 - added GUI
24 v1.0.1 - replaced '4' with '3.981071705534972'
25 v1.0.0 - initial release
26
27 **********************************************************************/
28
Disclaimer...
29 desc:Fader: Squared [+12dB], v1.1.0
30
31 slider1: 50 <0, 100, 0.1> Position [mm]
32
33 @init
34 gfx_clear = 256*256*256-1;
35 m = 1;
36
37 @slider
38 c = slider1 / 100.0;
39 m = c * c;
40 m *= 3.981071705534972;
41
42 @sample
43 spl0 *= m;
44 spl1 *= m;
45
46
Graphics...
48 @gfx 256 256
49 gfx_setfont(1, "Arial", 10);
50 gfx_a = 1;
51
52 gfx_r = gfx_g = gfx_b = 0.1;
53 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
54 gfx_line(0, 0, 0, gfx_h, 0.5);
55 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
56 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
57
58 x_step = gfx_w / 10;
59 y_step = gfx_h / 10;
60
61 i = 1;
62 loop(9, // y-axiis
63 x = i*x_step;
64 gfx_line(x, y_step, x, y_step*8, 0.5);
65 i += 1;
66 );
67
68 gfx_x = x_step - 2;
69 gfx_y = gfx_h - 2*y_step + 9;
70 gfx_drawchar($'0');
71 gfx_drawchar($'m');
72 gfx_drawchar($'m');
73
74 gfx_x = 3*x_step - 7;
75 gfx_y = gfx_h - 2*y_step + 9;
76 gfx_drawchar($'2');
77 gfx_drawchar($'5');
78 gfx_drawchar($'m');
79 gfx_drawchar($'m');
80
81 gfx_x = 5*x_step - 7;
82 gfx_y = gfx_h - 2*y_step + 9;
83 gfx_drawchar($'5');
84 gfx_drawchar($'0');
85 gfx_drawchar($'m');
86 gfx_drawchar($'m');
87
88 gfx_x = 7*x_step - 7;
89 gfx_y = gfx_h - 2*y_step + 9;
90 gfx_drawchar($'7');
91 gfx_drawchar($'5');
92 gfx_drawchar($'m');
93 gfx_drawchar($'m');
94
95 gfx_x = 9*x_step - 12;
96 gfx_y = gfx_h - 2*y_step + 9;
97 gfx_drawchar($'1');
98 gfx_drawchar($'0');
99 gfx_drawchar($'0');
100 gfx_drawchar($'m');
101 gfx_drawchar($'m');
102
103 i = 1;
104 loop(8, // x-axiis
105 y = i*y_step;
106 gfx_line(x_step-2, y, x_step*9, y, 0.5);
107 i += 1;
108 );
109
110 gfx_x = x_step - 36;
111 gfx_y = y_step - 6;
112 gfx_drawchar($'+');
113 gfx_drawchar($'1');
114 gfx_drawchar($'2');
115 gfx_drawchar($'d');
116 gfx_drawchar($'B');
117
118 gfx_x = x_step - 32;
119 gfx_y = 2*y_step - 7;
120 gfx_drawchar($' ');
121 gfx_drawchar($'0');
122 gfx_drawchar($' ');
123 gfx_drawchar($'d');
124 gfx_drawchar($'B');
125
126 gfx_x = x_step - 36;
127 gfx_y = 3*y_step - 7;
128 gfx_drawchar($'-');
129 gfx_drawchar($'1');
130 gfx_drawchar($'2');
131 gfx_drawchar($'d');
132 gfx_drawchar($'B');
133
134 gfx_x = x_step - 36;
135 gfx_y = 4*y_step - 7;
136 gfx_drawchar($'-');
137 gfx_drawchar($'2');
138 gfx_drawchar($'4');
139 gfx_drawchar($'d');
140 gfx_drawchar($'B');
141
142 gfx_x = x_step - 36;
143 gfx_y = 5*y_step - 7;
144 gfx_drawchar($'-');
145 gfx_drawchar($'3');
146 gfx_drawchar($'6');
147 gfx_drawchar($'d');
148 gfx_drawchar($'B');
149
150 gfx_x = x_step - 36;
151 gfx_y = 6*y_step - 7;
152 gfx_drawchar($'-');
153 gfx_drawchar($'4');
154 gfx_drawchar($'8');
155 gfx_drawchar($'d');
156 gfx_drawchar($'B');
157
158 gfx_x = x_step - 36;
159 gfx_y = 7*y_step - 7;
160 gfx_drawchar($'-');
161 gfx_drawchar($'6');
162 gfx_drawchar($'0');
163 gfx_drawchar($'d');
164 gfx_drawchar($'B');
165
166 gfx_x = x_step - 36;
167 gfx_y = 8*y_step - 8;
168 gfx_drawchar($'-');
169 gfx_drawchar($'7');
170 gfx_drawchar($'2');
171 gfx_drawchar($'d');
172 gfx_drawchar($'B');
173
174 gfx_r = gfx_g = 0.2;
175 gfx_b = 0.9;
176 m1 = m/3.981071705534972;
177 dB = 20 * log10(m1);
178 dB *= -1;
179 dB > 83 ? dB = 84;
180 m == 0? dB = 84;
181 y = y_step*dB/12 + y_step;
182 gfx_rect(x_step+2, y, x_step*8-2, 2, 0.5); // horizontal line
183 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-2, 0.5); // vertical line
184 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
185 gfx_x = gfx_w*.9+8;
186 gfx_y = y-6;
187 sprintf(str, "%.1fdB", -dB+12);
188 gfx_drawstr(str);
189 gfx_x = x_step+slider1/100*x_step*8-3;
190 gfx_y = y_step - 17;
191 sprintf(str, "%.1fmm", slider1);
192 gfx_drawstr(str);
193
194 gfx_g = 0.1;
195 gfx_b = gfx_r = 0.9;
196 RES = 100; // min = 8
197 x_step1 = x_step * 8/RES;
198
199 i = 1;
200 loop(RES, //8, // main curve
201 x = i*x_step1;
202
203 c=(i-1)/RES;
204 m1 = c^2;
205 dB = -20 * log10(m1);
206 dB > 83 ? dB = 84;
207 i == 1? dB = 84;
208 y = y_step*dB/12 + y_step;
209
210 c=(i)/RES;
211 m2 = c^2;
212 dB1 = -20 * log10(m2);
213 dB1 > 83 ? dB1 = 84;
214 i == 1 ? dB = 84;
215 y1 = y_step*dB1/12 + y_step;
216
217 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
218 i += 1;
219 );
220
221 gfx_setfont(1, "Arial", 12); // main title
222 gfx_r = gfx_g = gfx_b = 0.0;
223 gfx_x = x_step;
224 gfx_y = gfx_h - y_step + 3;
225 gfx_drawstr("Squared Fader: Gain (dB) - vs - Fader Travel (mm)");
226
227 // mouse
228 mouse_cap == 1 ? (
229 xx = mouse_x;
230 xx > gfx_w * 0.1 ? (
231 xx < gfx_w * 0.9 ? (
232 yy = mouse_y;
233 yy > gfx_h * 0.1 ? (
234 yy < gfx_h * 0.8 ? (
235 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
236 slider1 < 0.3 ? slider1 = floor(slider1);
237 slider1 > 99.7 ? slider1 = ceil(slider1);
238 slider1 = floor(slider1*10);
239 slider1 /= 10;
240 sliderchange(slider1);
241 slider_automate(slider1);
242 c = slider1 / 100.0;
243 m = c * c;
244 m *= 3.981071705534972;
245 )
246 );
247 );
248 );
249 );
Fader, Squared [+0dB]
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 MERCHANT-
16 ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO
17 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20 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:Fader: Squared [+0dB], v1.1.0
29
30 slider1: 70.7 <0, 100, 0.1> Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 m = 1;
35
36 @slider
37 c = slider1 / 100.0;
38 m = c * c;
39
40 @sample
41 spl0 *= m;
42 spl1 *= m;
43
44
Graphics...
46 @gfx 256 256
47 gfx_setfont(1, "Arial", 10);
48 gfx_a = 1;
49
50 gfx_r = gfx_g = gfx_b = 0.1;
51 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
52 gfx_line(0, 0, 0, gfx_h, 0.5);
53 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
54 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
55
56 x_step = gfx_w / 10;
57 y_step = gfx_h / 10;
58
59 i = 1;
60 loop(9, // y-axiis
61 x = i*x_step;
62 gfx_line(x, y_step, x, y_step*8, 0.5);
63 i += 1;
64 );
65
66 gfx_x = x_step - 2;
67 gfx_y = gfx_h - 2*y_step + 9;
68 gfx_drawchar($'0');
69 gfx_drawchar($'m');gfx_drawchar($'m');
70
71 gfx_x = 3*x_step - 7;
72 gfx_y = gfx_h - 2*y_step + 9;
73 gfx_drawchar($'2');
74 gfx_drawchar($'5');
75 gfx_drawchar($'m');gfx_drawchar($'m');
76
77 gfx_x = 5*x_step - 7;
78 gfx_y = gfx_h - 2*y_step + 9;
79 gfx_drawchar($'5');
80 gfx_drawchar($'0');
81 gfx_drawchar($'m');gfx_drawchar($'m');
82
83 gfx_x = 7*x_step - 7;
84 gfx_y = gfx_h - 2*y_step + 9;
85 gfx_drawchar($'7');
86 gfx_drawchar($'5');
87 gfx_drawchar($'m');gfx_drawchar($'m');
88
89 gfx_x = 9*x_step - 12;
90 gfx_y = gfx_h - 2*y_step + 9;
91 gfx_drawchar($'1');
92 gfx_drawchar($'0');
93 gfx_drawchar($'0');
94 gfx_drawchar($'m');gfx_drawchar($'m');
95
96 i = 1;
97 loop(8, // x-axiis
98 y = i*y_step;
99 gfx_line(x_step-2, y, x_step*9, y, 0.5);
100 i += 1;
101 );
102
103 gfx_x = x_step - 32;
104 gfx_y = y_step - 6;
105 gfx_drawchar($' ');
106 gfx_drawchar($'0');
107 gfx_drawchar($' ');
108 gfx_drawchar($'d');
109 gfx_drawchar($'B');
110
111 gfx_x = x_step - 36;
112 gfx_y = 2*y_step - 7;
113 gfx_drawchar($'-');
114 gfx_drawchar($'1');
115 gfx_drawchar($'2');
116 gfx_drawchar($'d');
117 gfx_drawchar($'B');
118
119 gfx_x = x_step - 36;
120 gfx_y = 3*y_step - 7;
121 gfx_drawchar($'-');
122 gfx_drawchar($'2');
123 gfx_drawchar($'4');
124 gfx_drawchar($'d');
125 gfx_drawchar($'B');
126
127 gfx_x = x_step - 36;
128 gfx_y = 4*y_step - 7;
129 gfx_drawchar($'-');
130 gfx_drawchar($'3');
131 gfx_drawchar($'6');
132 gfx_drawchar($'d');
133 gfx_drawchar($'B');
134
135 gfx_x = x_step - 36;
136 gfx_y = 5*y_step - 7;
137 gfx_drawchar($'-');
138 gfx_drawchar($'4');
139 gfx_drawchar($'8');
140 gfx_drawchar($'d');
141 gfx_drawchar($'B');
142
143 gfx_x = x_step - 36;
144 gfx_y = 6*y_step - 7;
145 gfx_drawchar($'-');
146 gfx_drawchar($'6');
147 gfx_drawchar($'0');
148 gfx_drawchar($'d');
149 gfx_drawchar($'B');
150
151 gfx_x = x_step - 36;
152 gfx_y = 7*y_step - 7;
153 gfx_drawchar($'-');
154 gfx_drawchar($'7');
155 gfx_drawchar($'2');
156 gfx_drawchar($'d');
157 gfx_drawchar($'B');
158
159 gfx_x = x_step - 36;
160 gfx_y = 8*y_step - 8;
161 gfx_drawchar($'-');
162 gfx_drawchar($'8');
163 gfx_drawchar($'4');
164 gfx_drawchar($'d');
165 gfx_drawchar($'B');
166
167 gfx_r = gfx_g = 0.1;
168 gfx_b = 0.9;
169 dB = 20 * log10(m);
170 dB *= -1;
171 dB > 83 ? dB = 84;
172 m == 0? dB = 84;
173 y = y_step*dB/12 + y_step;
174 gfx_rect(x_step+2, y, x_step*8-2, 2, 0.5); // horizontal line
175 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-2, 0.5); // vertical line
176 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
177 gfx_x = gfx_w*.9+8;
178 gfx_y = y-6;
179 sprintf(str, "%.1fdB", -dB);
180 gfx_drawstr(str);
181 gfx_x = x_step+slider1/100*x_step*8-9;
182 gfx_y = y_step - 17;
183 sprintf(str, "%.1fmm", slider1);
184 gfx_drawstr(str);
185
186 gfx_g = 0.2;
187 gfx_b = gfx_r = 0.9;
188 RES = 100; // min = 8
189 x_step1 = x_step * 8/RES;
190
191 i = 1;
192 loop(RES, //8, // main curve
193 x = i*x_step1;
194
195 c=(i-1)/RES;
196 m1 = c^2;
197 dB = -20 * log10(m1);
198 dB > 83 ? dB = 84;
199 i == 1? dB = 84;
200 y = y_step*dB/12 + y_step;
201
202 c=(i)/RES;
203 m2 = c^2;
204 dB1 = -20 * log10(m2);
205 dB1 > 83 ? dB1 = 84;
206 i == 1 ? dB = 84;
207 y1 = y_step*dB1/12 + y_step;
208
209 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
210 i += 1;
211 );
212
213 gfx_setfont(1, "Arial", 12); // main title
214 gfx_r = gfx_g = gfx_b = 0.0;
215 gfx_x = x_step;
216 gfx_y = gfx_h - y_step + 3;
217 gfx_drawstr("Squared Fader: Gain (dB) - vs - Fader Travel (mm)");
218
219 // mouse
220 mouse_cap == 1 ? (
221 xx = mouse_x;
222 xx > gfx_w * 0.1 ? (
223 xx < gfx_w * 0.9 ? (
224 yy = mouse_y;
225 yy > gfx_h * 0.1 ? (
226 yy < gfx_h * 0.8 ? (
227 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
228 slider1 < 0.3 ? slider1 = floor(slider1);
229 slider1 > 99.7 ? slider1 = ceil(slider1);
230 slider1 = floor(slider1*10);
231 slider1 /= 10;
232 sliderchange(slider1);
233 slider_automate(slider1);
234 c = slider1 / 100.0;
235 m = c * c;
236 )
237 );
238 );
239 );
240 );
241
242
Fader, Parallel [+12dB]
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.1 - replaced '4' with '3.981071705534972'
25 v1.0.0 - initial release
26
27 **********************************************************************/
28
Disclaimer...
29 desc:Fader: Parallel [+12dB], v1.1.0
30
31 slider1: 74.4 <0, 100, 0.1> Position [mm]
32
33 @init
34 gfx_clear = 256*256*256-1;
35 factor = 6800.0 / 27000.0;
36 m = 1.0;
37
38 @slider
39 c = slider1 / 100.0;
40 m = 3.981071705534972 / (((1-c)/c) + ((1-c)/factor) + 1.0);
41
42 @sample
43 spl0 *= m;
44 spl1 *= m;
45
46
Graphics...
48 @gfx 256 256
49 gfx_setfont(1, "Arial", 10);
50 gfx_a = 1;
51
52 gfx_r = gfx_g = gfx_b = 0.1;
53 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
54 gfx_line(0, 0, 0, gfx_h, 0.5);
55 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
56 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
57
58 x_step = gfx_w / 10;
59 y_step = gfx_h / 10;
60
61 i = 1;
62 loop(9, // y-axiis
63 x = i*x_step;
64 gfx_line(x, y_step, x, y_step*8, 0.5);
65 i += 1;
66 );
67
68 gfx_x = x_step - 2;
69 gfx_y = gfx_h - 2*y_step + 9;
70 gfx_drawchar($'0');
71 gfx_drawchar($'m');
72 gfx_drawchar($'m');
73
74 gfx_x = 3*x_step - 7;
75 gfx_y = gfx_h - 2*y_step + 9;
76 gfx_drawchar($'2');
77 gfx_drawchar($'5');
78 gfx_drawchar($'m');
79 gfx_drawchar($'m');
80
81 gfx_x = 5*x_step - 7;
82 gfx_y = gfx_h - 2*y_step + 9;
83 gfx_drawchar($'5');
84 gfx_drawchar($'0');
85 gfx_drawchar($'m');
86 gfx_drawchar($'m');
87
88 gfx_x = 7*x_step - 7;
89 gfx_y = gfx_h - 2*y_step + 9;
90 gfx_drawchar($'7');
91 gfx_drawchar($'5');
92 gfx_drawchar($'m');
93 gfx_drawchar($'m');
94
95 gfx_x = 9*x_step - 12;
96 gfx_y = gfx_h - 2*y_step + 9;
97 gfx_drawchar($'1');
98 gfx_drawchar($'0');
99 gfx_drawchar($'0');
100 gfx_drawchar($'m');
101 gfx_drawchar($'m');
102
103 i = 1;
104 loop(8, // x-axiis
105 y = i*y_step;
106 gfx_line(x_step-2, y, x_step*9, y, 0.5);
107 i += 1;
108 );
109
110 gfx_x = x_step - 36;
111 gfx_y = y_step - 6;
112 gfx_drawchar($'+');
113 gfx_drawchar($'1');
114 gfx_drawchar($'2');
115 gfx_drawchar($'d');
116 gfx_drawchar($'B');
117
118 gfx_x = x_step - 32;
119 gfx_y = 2*y_step - 7;
120 gfx_drawchar($' ');
121 gfx_drawchar($'0');
122 gfx_drawchar($' ');
123 gfx_drawchar($'d');
124 gfx_drawchar($'B');
125
126 gfx_x = x_step - 36;
127 gfx_y = 3*y_step - 7;
128 gfx_drawchar($'-');
129 gfx_drawchar($'1');
130 gfx_drawchar($'2');
131 gfx_drawchar($'d');
132 gfx_drawchar($'B');
133
134 gfx_x = x_step - 36;
135 gfx_y = 4*y_step - 7;
136 gfx_drawchar($'-');
137 gfx_drawchar($'2');
138 gfx_drawchar($'4');
139 gfx_drawchar($'d');
140 gfx_drawchar($'B');
141
142 gfx_x = x_step - 36;
143 gfx_y = 5*y_step - 7;
144 gfx_drawchar($'-');
145 gfx_drawchar($'3');
146 gfx_drawchar($'6');
147 gfx_drawchar($'d');
148 gfx_drawchar($'B');
149
150 gfx_x = x_step - 36;
151 gfx_y = 6*y_step - 7;
152 gfx_drawchar($'-');
153 gfx_drawchar($'4');
154 gfx_drawchar($'8');
155 gfx_drawchar($'d');
156 gfx_drawchar($'B');
157
158 gfx_x = x_step - 36;
159 gfx_y = 7*y_step - 7;
160 gfx_drawchar($'-');
161 gfx_drawchar($'6');
162 gfx_drawchar($'0');
163 gfx_drawchar($'d');
164 gfx_drawchar($'B');
165
166 gfx_x = x_step - 36;
167 gfx_y = 8*y_step - 8;
168 gfx_drawchar($'-');
169 gfx_drawchar($'7');
170 gfx_drawchar($'2');
171 gfx_drawchar($'d');
172 gfx_drawchar($'B');
173
174 gfx_r = gfx_g = 0.2;
175 gfx_b = 0.9;
176 m1 = m/3.981071705534972;
177 dB = 20 * log10(m1);
178 dB *= -1;
179 dB > 83 ? dB = 84;
180 m == 0? dB = 84;
181 y = y_step*dB/12 + y_step;
182 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
183 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
184 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
185 gfx_x = gfx_w*.9+8;
186 gfx_y = y-6;
187 sprintf(str, "%.1fdB", -dB+12);
188 gfx_drawstr(str);
189 gfx_x = x_step+slider1/100*x_step*8-3;
190 gfx_y = y_step - 17;
191 sprintf(str, "%.1fmm", slider1);
192 gfx_drawstr(str);
193
194 gfx_g = 0.1;
195 gfx_b = gfx_r = 0.9;
196 RES = 100; // min = 8
197 x_step1 = x_step * 8/RES;
198
199 i = 1;
200 loop(RES, //8, // main curve
201 x = i*x_step1;
202 c=(i-1)/RES;
203 m1 = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
204 dB = -20 * log10(m1); dB > 83 ? dB = 84;
205 i == 1? dB = 84;
206 y = y_step*dB/12 + y_step;
207
208 c=(i)/RES;
209 m2 = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
210 dB1 = -20 * log10(m2);
211 dB1 > 83 ? dB1 = 84;
212 i == 1 ? dB = 84;
213 y1 = y_step*dB1/12 + y_step;
214
215 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
216 i += 1;
217 );
218
219 gfx_setfont(1, "Arial", 12); // main title
220 gfx_r = gfx_g = gfx_b = 0.0;
221 gfx_x = x_step;
222 gfx_y = gfx_h - y_step + 3;
223 gfx_drawstr("Parallel Fader: Gain (dB) - vs - Fader Travel (mm)");
224
225 // mouse
226 mouse_cap == 1 ? (
227 xx = mouse_x;
228 xx > gfx_w * 0.1 ? (
229 xx < gfx_w * 0.9 ? (
230 yy = mouse_y;
231 yy > gfx_h * 0.1 ? (
232 yy < gfx_h * 0.8 ? (
233 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
234 slider1 < 0.3 ? slider1 = floor(slider1);
235 slider1 > 99.7 ? slider1 = ceil(slider1);
236 slider1 = floor(slider1*10);
237 slider1 /= 10;
238 sliderchange(slider1);
239 slider_automate(slider1);
240 c = slider1/100;
241 d = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
242 m = 3.981071705534972 * d;
243 )
244 );
245 );
246 );
247 );
248
249
Fader, Parallel [+0dB]
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:Fader: Parallel [+0dB], v1.1.0
29
30 slider1:50<0,100,.1>Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 factor = 6800.0 / 27000.0;
35 m = 0.5;
36
37 @slider
38 c = slider1/100.0; // 0 < m < 1.0, effectively 0-100%
39 m = 1 / (((1-c)/c) + ((1-c)/factor) + 1);
40
41 @sample
42 spl0 *= m;
43 spl1 *= m;
44
45
Graphics...
47 @gfx 256 256
48 gfx_setfont(1, "Arial", 10);
49 gfx_a = 1;
50
51 gfx_r = gfx_g = gfx_b = 0.1;
52 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
53 gfx_line(0, 0, 0, gfx_h, 0.5);
54 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
55 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
56
57 x_step = gfx_w / 10;
58 y_step = gfx_h / 10;
59
60 i = 1;
61 loop(9, // y-axiis
62 x = i*x_step;
63 gfx_line(x, y_step, x, y_step*8, 0.5);
64 i += 1;
65 );
66
67 gfx_x = x_step - 2;
68 gfx_y = gfx_h - 2*y_step + 9;
69 gfx_drawchar($'0');
70 gfx_drawchar($'m');gfx_drawchar($'m');
71
72 gfx_x = 3*x_step - 7;
73 gfx_y = gfx_h - 2*y_step + 9;
74 gfx_drawchar($'2');
75 gfx_drawchar($'5');
76 gfx_drawchar($'m');gfx_drawchar($'m');
77
78 gfx_x = 5*x_step - 7;
79 gfx_y = gfx_h - 2*y_step + 9;
80 gfx_drawchar($'5');
81 gfx_drawchar($'0');
82 gfx_drawchar($'m');gfx_drawchar($'m');
83
84 gfx_x = 7*x_step - 7;
85 gfx_y = gfx_h - 2*y_step + 9;
86 gfx_drawchar($'7');
87 gfx_drawchar($'5');
88 gfx_drawchar($'m');gfx_drawchar($'m');
89
90 gfx_x = 9*x_step - 12;
91 gfx_y = gfx_h - 2*y_step + 9;
92 gfx_drawchar($'1');
93 gfx_drawchar($'0');
94 gfx_drawchar($'0');
95 gfx_drawchar($'m');gfx_drawchar($'m');
96
97 i = 1;
98 loop(8, // x-axiis
99 y = i*y_step;
100 gfx_line(x_step-2, y, x_step*9, y, 0.5);
101 i += 1;
102 );
103
104 gfx_x = x_step - 32;
105 gfx_y = y_step - 6;
106 gfx_drawchar($' ');
107 gfx_drawchar($'0');
108 gfx_drawchar($' ');
109 gfx_drawchar($'d');
110 gfx_drawchar($'B');
111
112 gfx_x = x_step - 36;
113 gfx_y = 2*y_step - 7;
114 gfx_drawchar($'-');
115 gfx_drawchar($'1');
116 gfx_drawchar($'2');
117 gfx_drawchar($'d');
118 gfx_drawchar($'B');
119
120 gfx_x = x_step - 36;
121 gfx_y = 3*y_step - 7;
122 gfx_drawchar($'-');
123 gfx_drawchar($'2');
124 gfx_drawchar($'4');
125 gfx_drawchar($'d');
126 gfx_drawchar($'B');
127
128 gfx_x = x_step - 36;
129 gfx_y = 4*y_step - 7;
130 gfx_drawchar($'-');
131 gfx_drawchar($'3');
132 gfx_drawchar($'6');
133 gfx_drawchar($'d');
134 gfx_drawchar($'B');
135
136 gfx_x = x_step - 36;
137 gfx_y = 5*y_step - 7;
138 gfx_drawchar($'-');
139 gfx_drawchar($'4');
140 gfx_drawchar($'8');
141 gfx_drawchar($'d');
142 gfx_drawchar($'B');
143
144 gfx_x = x_step - 36;
145 gfx_y = 6*y_step - 7;
146 gfx_drawchar($'-');
147 gfx_drawchar($'6');
148 gfx_drawchar($'0');
149 gfx_drawchar($'d');
150 gfx_drawchar($'B');
151
152 gfx_x = x_step - 36;
153 gfx_y = 7*y_step - 7;
154 gfx_drawchar($'-');
155 gfx_drawchar($'7');
156 gfx_drawchar($'2');
157 gfx_drawchar($'d');
158 gfx_drawchar($'B');
159
160 gfx_x = x_step - 36;
161 gfx_y = 8*y_step - 8;
162 gfx_drawchar($'-');
163 gfx_drawchar($'8');
164 gfx_drawchar($'4');
165 gfx_drawchar($'d');
166 gfx_drawchar($'B');
167
168 gfx_r = gfx_g = 0.1;
169 gfx_b = 0.9;
170 dB = 20 * log10(m);
171 dB *= -1;
172 dB > 83 ? dB = 84;
173 m == 0? dB = 84;
174 y = y_step*dB/12 + y_step;
175 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
176 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
177 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
178 gfx_x = gfx_w*.9+8;
179 gfx_y = y-6;
180 sprintf(str, "%.1fdB", -dB);
181 gfx_drawstr(str);
182 gfx_x = x_step+slider1/100*x_step*8-9;
183 gfx_y = y_step - 17;
184 sprintf(str, "%.1fmm", slider1);
185 gfx_drawstr(str);
186
187 gfx_g = 0.2;
188 gfx_b = gfx_r = 0.9;
189 RES = 100; // min = 8
190 x_step1 = x_step * 8/RES;
191
192 i = 1;
193 loop(RES, //8, // main curve
194 x = i*x_step1;
195 c=(i-1)/RES;
196 m1 = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
197 dB = -20 * log10(m1);
198 dB > 83 ? dB = 84;
199 i == 1? dB = 84;
200 y = y_step*dB/12 + y_step;
201
202 c=(i)/RES;
203 m2 = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
204 dB1 = -20 * log10(m2);
205 dB1 > 83 ? dB1 = 84;
206 i == 1 ? dB = 84;
207 y1 = y_step*dB1/12 + y_step;
208
209 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
210 i += 1;
211 );
212
213 gfx_setfont(1, "Arial", 12); // main title
214 gfx_r = gfx_g = gfx_b = 0.0;
215 gfx_x = x_step;
216 gfx_y = gfx_h - y_step + 3;
217 gfx_drawstr("Parallel Fader: Gain (dB) - vs - Fader Travel (mm)");
218
219 // mouse
220 mouse_cap == 1 ? (
221 xx = mouse_x;
222 xx > gfx_w * 0.1 ? (
223 xx < gfx_w * 0.9 ? (
224 yy = mouse_y;
225 yy > gfx_h * 0.1 ? (
226 yy < gfx_h * 0.8 ? (
227 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
228 slider1 < 0.3 ? slider1 = floor(slider1);
229 slider1 > 99.7 ? slider1 = ceil(slider1);
230 slider1 = floor(slider1*10);
231 slider1 /= 10;
232 sliderchange(slider1);
233 slider_automate(slider1);
234 c = slider1/100;
235 m = 1.0 / (((1-c)/c) + ((1-c)/factor) + 1.0);
236 );
237 );
238 );
239 );
240 );
241
242
Fader, Polynomial [+12dB]
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 MERCHANT-
16 ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO
17 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20 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:Fader: Polynomial [+12dB], v1.1.0
29
30 slider1: 71.54 <0, 100, 0.1> Position [mm]
31
32 @init
33 gfx_clear = 256*256*256-1;
34 m = 1;
35
36 @slider
37 c = slider1 / 100.0;
38 m = c^6 + c^3;
39 m *= 2.0;
40
41 @sample
42 spl0 *= m;
43 spl1 *= m;
44
45
Graphics...
47 @gfx 256 256
48 gfx_setfont(1, "Arial", 10);
49 gfx_a = 1;
50
51 gfx_r = gfx_g = gfx_b = 0.1;
52 gfx_line(0, 0, gfx_w, 0, 0.5); // outline our GUI box
53 gfx_line(0, 0, 0, gfx_h, 0.5);
54 gfx_line(gfx_w-1, 0, gfx_w-1, gfx_h, 0.5);
55 gfx_line(0, gfx_h-2, gfx_w, gfx_h-2, 0.5);
56
57 x_step = gfx_w / 10;
58 y_step = gfx_h / 10;
59
60 i = 1;
61 loop(9, // y-axiis
62 x = i*x_step;
63 gfx_line(x, y_step, x, y_step*8, 0.5);
64 i += 1;
65 );
66
67 gfx_x = x_step - 2;
68 gfx_y = gfx_h - 2*y_step + 9;
69 gfx_drawchar($'0');
70 gfx_drawchar($'m');
71 gfx_drawchar($'m');
72
73 gfx_x = 3*x_step - 7;
74 gfx_y = gfx_h - 2*y_step + 9;
75 gfx_drawchar($'2');
76 gfx_drawchar($'5');
77 gfx_drawchar($'m');
78 gfx_drawchar($'m');
79
80 gfx_x = 5*x_step - 7;
81 gfx_y = gfx_h - 2*y_step + 9;
82 gfx_drawchar($'5');
83 gfx_drawchar($'0');
84 gfx_drawchar($'m');
85 gfx_drawchar($'m');
86
87 gfx_x = 7*x_step - 7;
88 gfx_y = gfx_h - 2*y_step + 9;
89 gfx_drawchar($'7');
90 gfx_drawchar($'5');
91 gfx_drawchar($'m');
92 gfx_drawchar($'m');
93
94 gfx_x = 9*x_step - 12;
95 gfx_y = gfx_h - 2*y_step + 9;
96 gfx_drawchar($'1');
97 gfx_drawchar($'0');
98 gfx_drawchar($'0');
99 gfx_drawchar($'m');
100 gfx_drawchar($'m');
101
102 i = 1;
103 loop(8, // x-axiis
104 y = i*y_step;
105 gfx_line(x_step-2, y, x_step*9, y, 0.5);
106 i += 1;
107 );
108
109 gfx_x = x_step - 36;
110 gfx_y = y_step - 6;
111 gfx_drawchar($'+');
112 gfx_drawchar($'1');
113 gfx_drawchar($'2');
114 gfx_drawchar($'d');
115 gfx_drawchar($'B');
116
117 gfx_x = x_step - 32;
118 gfx_y = 2*y_step - 7;
119 gfx_drawchar($' ');
120 gfx_drawchar($'0');
121 gfx_drawchar($' ');
122 gfx_drawchar($'d');
123 gfx_drawchar($'B');
124
125 gfx_x = x_step - 36;
126 gfx_y = 3*y_step - 7;
127 gfx_drawchar($'-');
128 gfx_drawchar($'1');
129 gfx_drawchar($'2');
130 gfx_drawchar($'d');
131 gfx_drawchar($'B');
132
133 gfx_x = x_step - 36;
134 gfx_y = 4*y_step - 7;
135 gfx_drawchar($'-');
136 gfx_drawchar($'2');
137 gfx_drawchar($'4');
138 gfx_drawchar($'d');
139 gfx_drawchar($'B');
140
141 gfx_x = x_step - 36;
142 gfx_y = 5*y_step - 7;
143 gfx_drawchar($'-');
144 gfx_drawchar($'3');
145 gfx_drawchar($'6');
146 gfx_drawchar($'d');
147 gfx_drawchar($'B');
148
149 gfx_x = x_step - 36;
150 gfx_y = 6*y_step - 7;
151 gfx_drawchar($'-');
152 gfx_drawchar($'4');
153 gfx_drawchar($'8');
154 gfx_drawchar($'d');
155 gfx_drawchar($'B');
156
157 gfx_x = x_step - 36;
158 gfx_y = 7*y_step - 7;
159 gfx_drawchar($'-');
160 gfx_drawchar($'6');
161 gfx_drawchar($'0');
162 gfx_drawchar($'d');
163 gfx_drawchar($'B');
164
165 gfx_x = x_step - 36;
166 gfx_y = 8*y_step - 8;
167 gfx_drawchar($'-');
168 gfx_drawchar($'7');
169 gfx_drawchar($'2');
170 gfx_drawchar($'d');
171 gfx_drawchar($'B');
172
173 gfx_r = gfx_g = 0.2;
174 gfx_b = 0.9;
175 m1 = m/3.981071705534972;
176 dB = 20 * log10(m1);
177 dB *= -1;
178 dB > 83 ? dB = 84;
179 m == 0? dB = 84;
180 y = y_step*dB/12 + y_step;
181 gfx_rect(x_step+2, y, x_step*8-3, 2, 0.5); // horizontal line
182 gfx_rect(x_step+slider1/100*x_step*8, y_step+2, 1, y_step*7-3, 0.5); // vertical line
183 gfx_rect(x_step+slider1/100*x_step*8-3, y-2, 6, 6, 0.5); // hilite box
184 gfx_x = gfx_w*.9+8;
185 gfx_y = y-6;
186 sprintf(str, "%.1fdB", -dB+12);
187 gfx_drawstr(str);
188 gfx_x = x_step+slider1/100*x_step*8-3;
189 gfx_y = y_step - 17;
190 sprintf(str, "%.1fmm", slider1);
191 gfx_drawstr(str);
192
193 gfx_g = 0.1;
194 gfx_b = gfx_r = 0.9;
195 RES = 100; // min = 8
196 x_step1 = x_step * 8/RES;
197
198 i = 1;
199 loop(RES, //8, // main curve
200 x = i*x_step1;
201 c=(i-1)/RES;
202 m1 = c^6 + c^3;
203 m1 /= 2.0;
204 dB = -20 * log10(m1); dB > 83 ? dB = 84;
205 i == 1? dB = 84;
206 y = y_step*dB/12 + y_step;
207
208 c=(i)/RES;
209 m2 = c^6 + c^3;
210 m2 /= 2.0;
211 dB1 = -20 * log10(m2);
212 dB1 > 83 ? dB1 = 84;
213 i == 1 ? dB = 84;
214 y1 = y_step*dB1/12 + y_step;
215
216 gfx_line(x_step+x-x_step1, y, x_step+x, y1, 0.5);
217 i += 1;
218 );
219
220 gfx_setfont(1, "Arial", 12); // main title
221 gfx_r = gfx_g = gfx_b = 0.0;
222 gfx_x = x_step;
223 gfx_y = gfx_h - y_step + 3;
224 gfx_drawstr("Polynomial Fader: Gain (dB) - vs - Fader Travel (mm)");
225
226 // mouse
227 mouse_cap == 1 ? (
228 xx = mouse_x;
229 xx > gfx_w * 0.1 ? (
230 xx < gfx_w * 0.9 ? (
231 yy = mouse_y;
232 yy > gfx_h * 0.1 ? (
233 yy < gfx_h * 0.8 ? (
234 slider1 = 100 * (xx - gfx_w*.1) / (gfx_w*.9 - gfx_w*.1);
235 slider1 < 0.3 ? slider1 = floor(slider1);
236 slider1 > 99.7 ? slider1 = ceil(slider1);
237 slider1 = floor(slider1*10);
238 slider1 /= 10;
239 sliderchange(slider1);
240 slider_automate(slider1);
241 c = slider1/100;
242 m = c^6 + c^3;
243 m *= 2.0;
244 )
245 );
246 );
247 );
248 );
249
250