| 1 |
// name: hevymetl-trumpet-algo3.ck |
| 2 |
// desc: demo of how to turn HevyMetl (Algorithm 3) into an FM Trumpet!! |
| 3 |
// now you can transcribe (somewhat) directly from a TX81 Patch!!! |
| 4 |
// |
| 5 |
// author: Perry R. Cook |
| 6 |
// date: June 2021, for REPAIRATHON 2021 |
| 7 |
// needs chuck 1.4.1.0 or above |
| 8 |
|
| 9 |
|
| 10 |
// patch |
| 11 |
HevyMetl t => NRev r => dac; |
| 12 |
// reverb mix |
| 13 |
0.06 => r.mix; |
| 14 |
|
| 15 |
// want to learn more about HevyMetl? uncomment this: |
| 16 |
// t.help(); |
| 17 |
|
| 18 |
// FM |
| 19 |
[1,6,6,1] @=> int waveForms[]; |
| 20 |
[99,85,74,99] @=> int opGains[]; // [93,75,54,81] from patch |
| 21 |
[1.0,1.0,2.9,1.0] @=> float ratios[]; |
| 22 |
[15,14,15,15] @=> int attacks[]; // [18,14,15,15] from patch |
| 23 |
[31,20,26,14] @=> int decays[]; // [31,31,26,31] from patch |
| 24 |
[15,10,13,15] @=> int sustains[]; // [15,15,13,15] from patch |
| 25 |
[10,10,10,10] @=> int releases[]; // [8,8,8,8] from patch |
| 26 |
|
| 27 |
// ops |
| 28 |
for( int op; op < 4; op++ ) |
| 29 |
{ |
| 30 |
t.opWave( op, waveForms[op] ); // sine waves all |
| 31 |
t.opGain( op, t.getFMTableGain(opGains[op]) ); |
| 32 |
t.opADSR( op, t.getFMTableTime(attacks[op]), |
| 33 |
t.getFMTableTime(decays[op]), |
| 34 |
t.getFMTableSusLevel(sustains[op]), |
| 35 |
t.getFMTableTime(releases[op]) ); |
| 36 |
t.opRatio( op, ratios[op] ); |
| 37 |
} |
| 38 |
|
| 39 |
// t.setOpGain(1,0.0); |
| 40 |
t.op4Feedback(0.5); |
| 41 |
|
| 42 |
// our notes |
| 43 |
[ 64, 62, 67, 69, 74, 71, 69, 74, 71, 67, 72, 69, 67] @=> int notes[]; |
| 44 |
[2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 9] @=> int durs[]; |
| 45 |
|
| 46 |
0.005 => t.lfoDepth; |
| 47 |
|
| 48 |
for( 0 => int i; i < notes.cap(); i++ ) |
| 49 |
{ |
| 50 |
Std.mtof( 14 + notes[i] ) => t.freq; |
| 51 |
0.7 => t.noteOn; |
| 52 |
if (i == notes.cap()-1) 0.05 => t.lfoDepth; |
| 53 |
(0.2 * durs[i]) :: second => now; |
| 54 |
1.0 => t.noteOff; |
| 55 |
(0.1 * durs[i]) :: second => now; |
| 56 |
} |