Add 21 primitives to Faustine.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / faust-stk / piano.h
1 //Parameters for piano.dsp
2 //©Romain Michon (rmichon@ccrma.stanford.edu), 2011
3 //licence: FAUST-STK
4
5 #include "instrument.h"
6
7 #define _LOOKUP_TABLE_H_
8
9 //**********************************************************************
10
11 extern LookupTable noteOffDelayTime;
12
13 /* pianoDriverC.sb */
14 /* Coupling Filter */
15
16 extern LookupTable singleStringDecayRate;
17 extern LookupTable singleStringZero;
18 extern LookupTable singleStringPole;
19 extern LookupTable releaseLoopGain;
20 extern LookupTable detuningHz;
21 extern LookupTable stiffnessCoefficient;
22 extern LookupTable strikePosition;
23 extern LookupTable EQGain;
24 extern LookupTable EQBandwidthFactor;
25
26 /* PianoDriverA */
27 /* HammerFilter */
28 extern LookupTable loudPole;
29 extern LookupTable softPole;
30 extern LookupTable normalizedVelocity;
31 extern LookupTable loudGain;
32 extern LookupTable softGain;
33
34
35 /* Soundboard */
36 extern LookupTable sustainPedalLevel;
37 extern LookupTable DryTapAmpT60;
38 extern double DryTapAmpCurrent;
39 extern LookupTable DCBa1;
40
41
42 /* pianoDriverB */
43 /* High Notes */
44 extern LookupTable secondStageAmpRatio;
45 extern LookupTable r1_1db;
46 extern LookupTable r1_2db;
47 extern LookupTable r2db;
48 extern LookupTable r3db;
49 extern LookupTable secondPartialFactor;
50 extern LookupTable thirdPartialFactor;
51 extern LookupTable bq4_gEarBalled;
52
53 //***************************************************************
54
55 /* PianoDriver.sb */
56 double noteOffDelayTime_points[5*2] = {
57 89.000,3.000,
58 93.000,2.000,
59 95.000,1.500,
60 99.782,1.020,
61 108.000,0.300,
62 };
63 LookupTable noteOffDelayTime(&noteOffDelayTime_points[0], 5);
64
65 /* pianoDriverC.sb */
66 /* Coupling Filter */
67
68 double singleStringDecayRate_points[17*2] = {
69 21.000,-1.500,
70 24.000,-1.500,
71 28.000,-1.500,
72 29.000,-6.000,
73 36.000,-6.000,
74 42.000,-6.100,
75 48.000,-7.000,
76 52.836,-7.000,
77 60.000,-7.300,
78 66.000,-7.700,
79 72.000,-8.000,
80 78.000,-8.800,
81 84.000,-10.000,
82 88.619,-11.215,
83 92.368,-12.348,
84 95.684,-13.934,
85 99.000,-15.000
86 };
87 LookupTable singleStringDecayRate(&singleStringDecayRate_points[0], 17);
88
89 double singleStringZero_points[17*2] = {
90 21.000,-1.000,
91 24.000,-1.000,
92 28.000,-1.000,
93 29.000,-1.000,
94 32.534,-1.000,
95 36.000,-0.700,
96 42.000,-0.400,
97 48.000,-0.200,
98 54.000,-0.120,
99 60.000,-0.080,
100 66.000,-0.070,
101 72.000,-0.070,
102 79.000,-0.065,
103 84.000,-0.063,
104 88.000,-0.060,
105 96.000,-0.050,
106 99.000,-0.050 };
107 LookupTable singleStringZero(&singleStringZero_points[0], 17);
108
109 double singleStringPole_points[17*2] = {
110 21.000,0.350,
111 24.604,0.318,
112 26.335,0.279,
113 28.000,0.250,
114 32.000,0.150,
115 36.000,0.000,
116 42.000,0.000,
117 48.000,0.000,
118 54.000,0.000,
119 60.000,0.000,
120 66.000,0.000,
121 72.000,0.000,
122 76.000,0.000,
123 84.000,0.000,
124 88.000,0.000,
125 96.000,0.000,
126 99.000,0.000 };
127 LookupTable singleStringPole(&singleStringPole_points[0], 17);
128
129 double releaseLoopGain_points[10*2] = {
130 21.000,0.865,
131 24.000,0.880,
132 29.000,0.896,
133 36.000,0.910,
134 48.000,0.920,
135 60.000,0.950,
136 72.000,0.965,
137 84.000,0.988,
138 88.000,0.997,
139 99.000,0.988 };
140 LookupTable releaseLoopGain(&releaseLoopGain_points[0], 10);
141
142 double detuningHz_points[18*2] = {
143 21.000,0.003,
144 24.000,0.003,
145 28.000,0.003,
146 29.000,0.060,
147 31.000,0.100,
148 36.000,0.110,
149 42.000,0.120,
150 48.000,0.200,
151 54.000,0.200,
152 60.000,0.250,
153 66.000,0.270,
154 72.232,0.300,
155 78.000,0.350,
156 84.000,0.500,
157 88.531,0.582,
158 92.116,0.664,
159 95.844,0.793,
160 99.000,1.000 };
161 LookupTable detuningHz(&detuningHz_points[0], 18);
162
163 double stiffnessCoefficient_points[10*2] = {
164 21.000,-0.850,
165 23.595,-0.850,
166 27.055,-0.830,
167 29.000,-0.700,
168 37.725,-0.516,
169 46.952,-0.352,
170 60.000,-0.250,
171 73.625,-0.036,
172 93.810,-0.006,
173 99.000,1.011 };
174 LookupTable stiffnessCoefficient(&stiffnessCoefficient_points[0], 10);
175
176 double strikePosition_points[12*2] = {
177 21.000,0.050,
178 24.000,0.050,
179 28.000,0.050,
180 35.000,0.050,
181 41.000,0.050,
182 42.000,0.125,
183 48.000,0.125,
184 60.000,0.125,
185 72.000,0.125,
186 84.000,0.125,
187 96.000,0.125,
188 99.000,0.125 };
189 LookupTable strikePosition(&strikePosition_points[0], 12);
190
191 double EQGain_points[14*2] = {
192 21.000,2.000,
193 24.000,2.000,
194 28.000,2.000,
195 30.000,2.000,
196 35.562,1.882,
197 41.000,1.200,
198 42.000,0.600,
199 48.000,0.500,
200 54.000,0.500,
201 59.928,0.502,
202 66.704,0.489,
203 74.201,0.477,
204 91.791,1.000,
205 99.000,1.000 };
206 LookupTable EQGain(&EQGain_points[0], 14);
207
208 double EQBandwidthFactor_points[13*2] = {
209 21.000,5.000,
210 24.112,5.000,
211 28.000,5.000,
212 35.000,4.956,
213 41.000,6.000,
214 42.000,2.000,
215 48.773,1.072,
216 57.558,1.001,
217 63.226,1.048,
218 69.178,1.120,
219 72.862,1.525,
220 80.404,2.788,
221 97.659,1.739 };
222 LookupTable EQBandwidthFactor(&EQBandwidthFactor_points[0], 13);
223
224
225 /* PianoDriverA */
226 /* HammerFilter */
227
228 double loudPole_points[19*2] = {
229 21.000,0.875,
230 23.719,0.871,
231 27.237,0.836,
232 28.996,0.828,
233 32.355,0.820,
234 36.672,0.816,
235 40.671,0.820,
236 45.788,0.812,
237 47.867,0.812,
238 54.000,0.810,
239 60.000,0.800,
240 66.000,0.800,
241 72.000,0.810,
242 78.839,0.824,
243 84.446,0.844,
244 89.894,0.844,
245 96.463,0.848,
246 103.512,0.840,
247 107.678,0.840 };
248 LookupTable loudPole(&loudPole_points[0], 19);
249
250 double softPole_points[16*2] = {
251 21.000,0.990,
252 24.000,0.990,
253 28.000,0.990,
254 29.000,0.990,
255 36.000,0.990,
256 42.000,0.990,
257 48.000,0.985,
258 54.000,0.970,
259 60.000,0.960,
260 66.000,0.960,
261 72.000,0.960,
262 78.000,0.970,
263 84.673,0.975,
264 91.157,0.990,
265 100.982,0.970,
266 104.205,0.950 };
267 LookupTable softPole(&softPole_points[0], 16);
268
269 double normalizedVelocity_points[8*2] = {
270 0.000,0.000,
271 0.170,0.318,
272 0.316,0.546,
273 0.460,0.709,
274 0.599,0.825,
275 0.717,0.894,
276 0.841,0.945,
277 1.000,1.000 };
278 LookupTable normalizedVelocity(&normalizedVelocity_points[0], 8);
279
280 double loudGain_points[16*2] = {
281 21.873,0.891,
282 25.194,0.870,
283 30.538,0.848,
284 35.448,0.853,
285 41.513,0.842,
286 47.434,0.826,
287 53.644,0.820,
288 60.720,0.815,
289 65.630,0.820,
290 72.995,0.853,
291 79.060,0.920,
292 85.270,1.028,
293 91.624,1.247,
294 95.668,1.296,
295 99.000,1.300,
296 100.000,1.100 };
297 LookupTable loudGain(&loudGain_points[0], 16);
298
299 double softGain_points[15*2] = {
300 20.865,0.400,
301 22.705,0.400,
302 25.960,0.400,
303 28.224,0.400,
304 31.196,0.400,
305 36.715,0.400,
306 44.499,0.400,
307 53.981,0.400,
308 60.000,0.350,
309 66.000,0.350,
310 72.661,0.350,
311 81.435,0.430,
312 88.311,0.450,
313 93.040,0.500,
314 96.434,0.500 };
315 LookupTable softGain(&softGain_points[0], 15);
316
317
318 /* Soundboard */
319
320 double sustainPedalLevel_points[13*2] = {
321 21.000,0.050,
322 24.000,0.050,
323 31.000,0.030,
324 36.000,0.025,
325 48.000,0.010,
326 60.000,0.005,
327 66.000,0.003,
328 72.000,0.002,
329 78.000,0.002,
330 84.000,0.003,
331 90.000,0.003,
332 96.000,0.003,
333 108.000,0.002 };
334 LookupTable sustainPedalLevel(&sustainPedalLevel_points[0], 13);
335
336 double DryTapAmpT60_points[16*2] = {
337 21.001,0.491,
338 26.587,0.498,
339 34.249,0.470,
340 40.794,0.441,
341 47.977,0.392,
342 55.000,0.370,
343 60.000,0.370,
344 66.000,0.370,
345 71.934,0.370,
346 78.000,0.370,
347 83.936,0.390,
348 88.557,0.387,
349 92.858,0.400,
350 97.319,0.469,
351 102.400,0.500,
352 107.198,0.494 };
353 LookupTable DryTapAmpT60(&DryTapAmpT60_points[0], 16);
354
355 double DryTapAmpCurrent = 0.15;
356
357 double DCBa1_points[18*2] = {
358 21.000,-0.999,
359 24.000,-0.999,
360 30.000,-0.999,
361 36.000,-0.999,
362 42.000,-0.999,
363 48.027,-0.993,
364 60.000,-0.995,
365 72.335,-0.960,
366 78.412,-0.924,
367 84.329,-0.850,
368 87.688,-0.770,
369 91.000,-0.700,
370 92.000,-0.910,
371 96.783,-0.850,
372 99.000,-0.800,
373 100.000,-0.850,
374 104.634,-0.700,
375 107.518,-0.500 };
376 LookupTable DCBa1(&DCBa1_points[0], 18);
377
378 /* pianoDriverB */
379 /* High Notes */
380
381 double secondStageAmpRatio_points[6*2] = {
382 82.277,-18.508,
383 88.000,-30.000,
384 90.000,-30.000,
385 93.451,-30.488,
386 98.891,-30.633,
387 107.573,-30.633 };
388 LookupTable secondStageAmpRatio(&secondStageAmpRatio_points[0], 6);
389
390 double r1_1db_points[3*2] = {
391 100.000,-75.000,
392 103.802,-237.513,
393 108.000,-400.000 };
394 LookupTable r1_1db(&r1_1db_points[0], 3);
395
396 double r1_2db_points[4*2] = {
397 98.388,-16.562,
398 100.743,-75.531,
399 103.242,-154.156,
400 108.000,-300.000 };
401 LookupTable r1_2db(&r1_2db_points[0], 4);
402
403 double r2db_points[2*2] = {
404 100.000,-115.898,
405 107.858,-250.000 };
406 LookupTable r2db(&r2db_points[0], 2);
407
408 double r3db_points[2*2] = {
409 100.000,-150.000,
410 108.000,-400.000 };
411 LookupTable r3db(&r3db_points[0], 2);
412
413 double secondPartialFactor_points[2*2] = {
414 88.000,2.000,
415 108.000,2.100 };
416 LookupTable secondPartialFactor(&secondPartialFactor_points[0], 2);
417
418 double thirdPartialFactor_points[2*2] = {
419 88.000,3.100,
420 108.000,3.100 };
421 LookupTable thirdPartialFactor(&thirdPartialFactor_points[0], 2);
422
423 double bq4_gEarBalled_points[6*2] = {
424 100.000,0.040,
425 102.477,0.100,
426 104.518,0.300,
427 106.000,0.500,
428 107.000,1.000,
429 108.000,1.500 };
430 LookupTable bq4_gEarBalled(&bq4_gEarBalled_points[0], 6);
431
432 //************************************************************************
433
434 float getValueDryTapAmpT60 (float index){
435 return DryTapAmpT60.getValue(index);
436 }
437
438 float getValueSustainPedalLevel (float index){
439 return sustainPedalLevel.getValue(index);
440 }
441
442 float getValueLoudPole(float index){
443 return loudPole.getValue(index);
444 }
445
446 float getValuePoleValue(float index){
447 return softPole.getValue(index);
448 }
449
450 float getValueLoudGain(float index){
451 return loudGain.getValue(index);
452 }
453
454 float getValueSoftGain(float index){
455 return softGain.getValue(index);
456 }
457
458 float getValueDCBa1(float index){
459 return DCBa1.getValue(index);
460 }
461
462 float getValuer1_1db(float index){
463 return r1_1db.getValue(index);
464 }
465
466 float getValuer1_2db(float index){
467 return r1_2db.getValue(index);
468 }
469
470 float getValuer2db(float index){
471 return r2db.getValue(index);
472 }
473
474 float getValuer3db(float index){
475 return r3db.getValue(index);
476 }
477
478 float getValueSecondStageAmpRatio(float index){
479 return secondStageAmpRatio.getValue(index);
480 }
481
482 float getValueSecondPartialFactor(float index){
483 return secondPartialFactor.getValue(index);
484 }
485
486 float getValueThirdPartialFactor(float index){
487 return thirdPartialFactor.getValue(index);
488 }
489
490 float getValueBq4_gEarBalled(float index){
491 return bq4_gEarBalled.getValue(index);
492 }
493
494 float getValueStrikePosition(float index){
495 return strikePosition.getValue(index);
496 }
497
498 float getValueEQBandWidthFactor(float index){
499 return EQBandwidthFactor.getValue(index);
500 }
501
502 float getValueEQGain(float index){
503 return EQGain.getValue(index);
504 }
505
506 float getValueDetuningHz(float index){
507 return detuningHz.getValue(index);
508 }
509
510 float getValueSingleStringDecayRate(float index){
511 return singleStringDecayRate.getValue(index);
512 }
513
514 float getValueSingleStringZero(float index){
515 return singleStringZero.getValue(index);
516 }
517
518 float getValueSingleStringPole(float index){
519 return singleStringPole.getValue(index);
520 }
521
522 float getValueStiffnessCoefficient(float index){
523 return stiffnessCoefficient.getValue(index);
524 }
525
526 float getValueReleaseLoopGain(float index){
527 return releaseLoopGain.getValue(index);
528 }
529
530 //Harpsichord
531
532 double loopFilterb0_points[18*2] = {
533 35.000,0.94373,
534 36.000,0.94731,
535 46.000,0.94731,
536 47.000,0.96202,
537 52.000,0.96202,
538 53.000,0.97477,
539 58.000,0.97477,
540 59.000,0.97733,
541 64.000,0.97733,
542 65.000,0.97971,
543 70.000,0.97971,
544 71.000,0.97971,
545 76.000,0.97971,
546 77.000,0.98698,
547 82.000,0.98698,
548 83.000,0.98462,
549 86.000,0.98462,
550 87.000,0.98611,
551 };
552 extern LookupTable loopFilterb0;
553 LookupTable loopFilterb0(&loopFilterb0_points[0], 18);
554
555 float getValueLoopFilterb0(float index){
556 return loopFilterb0.getValue(index);
557 }
558
559 double loopFilterb1_points[18*2] = {
560 35.000,0.60010,
561 36.000,-0.59124,
562 46.000,-0.59124,
563 47.000,-0.21243,
564 52.000,-0.21243,
565 53.000,-0.39280,
566 58.000,-0.39280,
567 59.000,-0.48307,
568 64.000,-0.48307,
569 65.000,0.51965,
570 70.000,0.51965,
571 71.000,0.51965,
572 76.000,0.51965,
573 77.000,-0.42463,
574 82.000,-0.42463,
575 83.000,0.85655,
576 86.000,0.85655,
577 87.000,0.68851,
578 };
579 extern LookupTable loopFilterb1;
580 LookupTable loopFilterb1(&loopFilterb1_points[0], 18);
581
582 float getValueLoopFilterb1(float index){
583 return loopFilterb1.getValue(index);
584 }
585
586 double loopFilterb2_points[18*2] = {
587 35.000,-0.00360,
588 36.000,-0.12249,
589 46.000,-0.12249,
590 47.000,-0.16044,
591 52.000,-0.16044,
592 53.000,-0.21680,
593 58.000,-0.21680,
594 59.000,-0.16346,
595 64.000,-0.16346,
596 65.000,0.22162,
597 70.000,0.22162,
598 71.000,0.22162,
599 76.000,0.22162,
600 77.000,-0.14973,
601 82.000,-0.14973,
602 83.000,0.24937,
603 86.000,0.24937,
604 87.000,0.14838,
605 };
606 extern LookupTable loopFilterb2;
607 LookupTable loopFilterb2(&loopFilterb2_points[0], 18);
608
609 float getValueLoopFilterb2(float index){
610 return loopFilterb2.getValue(index);
611 }
612
613 double loopFiltera1_points[18*2] = {
614 35.000,0.5941,
615 36.000,-0.65928,
616 46.000,-0.65928,
617 47.000,-0.24222,
618 52.000,-0.24222,
619 53.000,-0.41402,
620 58.000,-0.41402,
621 59.000,-0.50837,
622 64.000,-0.50837,
623 65.000,0.51263,
624 70.000,0.51263,
625 71.000,0.51263,
626 76.000,0.51263,
627 77.000,-0.43976,
628 82.000,-0.43976,
629 83.000,0.85396,
630 86.000,0.85396,
631 87.000,0.68332,
632 };
633 extern LookupTable loopFiltera1;
634 LookupTable loopFiltera1(&loopFiltera1_points[0], 18);
635
636 float getValueLoopFiltera1(float index){
637 return loopFiltera1.getValue(index);
638 }
639
640 double loopFiltera2_points[18*2] = {
641 35.000,-0.02641,
642 36.000,-0.10275,
643 46.000,-0.10275,
644 47.000,-0.15842,
645 52.000,-0.15842,
646 53.000,-0.21653,
647 58.000,-0.21653,
648 59.000,-0.15833,
649 64.000,-0.15833,
650 65.000,0.22025,
651 70.000,0.22025,
652 71.000,0.22025,
653 76.000,0.22025,
654 77.000,-0.14583,
655 82.000,-0.14583,
656 83.000,0.24405,
657 86.000,0.24405,
658 87.000,0.14370,
659 };
660 extern LookupTable loopFiltera2;
661 LookupTable loopFiltera2(&loopFiltera2_points[0], 18);
662
663 float getValueLoopFiltera2(float index){
664 return loopFiltera2.getValue(index);
665 }
666
667 //bass
668
669 double bassLoopFilterb0_points[19*2] = {
670 24.000,0.54355,
671 26.000,0.54355,
672 27.000,0.55677,
673 29.000,0.55677,
674 32.000,0.55677,
675 33.000,0.83598,
676 36.000,0.83598,
677 43.000,0.83598,
678 44.000,0.88292,
679 48.000,0.88292,
680 51.000,0.88292,
681 52.000,0.77805,
682 54.000,0.77805,
683 57.000,0.77805,
684 58.000,0.91820,
685 60.000,0.91820,
686 61.000,0.91820,
687 63.000,0.94594,
688 65.000,0.91820,
689 };
690 extern LookupTable bassLoopFilterb0;
691 LookupTable bassLoopFilterb0(&bassLoopFilterb0_points[0], 18);
692
693 float getValueBassLoopFilterb0(float index){
694 return bassLoopFilterb0.getValue(index);
695 }
696
697 double bassLoopFilterb1_points[19*2] = {
698 24.000,-0.36586,
699 26.000,-0.36586,
700 27.000,-0.37628,
701 29.000,-0.37628,
702 32.000,-0.37628,
703 33.000,-0.60228,
704 36.000,-0.60228,
705 43.000,-0.60228,
706 44.000,-0.65721,
707 48.000,-0.65721,
708 51.000,-0.65721,
709 52.000,-0.51902,
710 54.000,-0.51902,
711 57.000,-0.51902,
712 58.000,-0.80765,
713 60.000,-0.80765,
714 61.000,-0.80765,
715 63.000,-0.83230,
716 65.000,-0.83230,
717 };
718 extern LookupTable bassLoopFilterb1;
719 LookupTable bassLoopFilterb1(&bassLoopFilterb1_points[0], 18);
720
721 float getValueBassLoopFilterb1(float index){
722 return bassLoopFilterb1.getValue(index);
723 }
724
725 double bassLoopFiltera1_points[19*2] = {
726 24.000,-0.81486,
727 26.000,-0.81486,
728 27.000,-0.81147,
729 29.000,-0.81147,
730 32.000,-0.81147,
731 33.000,-0.76078,
732 36.000,-0.76078,
733 43.000,-0.76078,
734 44.000,-0.77075,
735 48.000,-0.77075,
736 51.000,-0.77075,
737 52.000,-0.73548,
738 54.000,-0.73548,
739 57.000,-0.73548,
740 58.000,-0.88810,
741 60.000,-0.88810,
742 61.000,-0.88810,
743 63.000,-0.88537,
744 65.000,-0.88537,
745 };
746 extern LookupTable bassLoopFiltera1;
747 LookupTable bassLoopFiltera1(&bassLoopFiltera1_points[0], 18);
748
749 float getValueBassLoopFiltera1(float index){
750 return bassLoopFiltera1.getValue(index);
751 }