From CSWiki
// Triangular Popcorn - A poor version of Popcorn in chuck.
// Copyright (C) 2007 Ryan Henszey <henszey@gmail.com>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
TriOsc s => dac;
60 => int c; 72 => int C; 84 => int hC;
61 => int cs; 73 => int Cs; 85 => int hCs;
62 => int d; 74 => int D; 86 => int hD;
63 => int ds; 75 => int Ds; 87 => int hDs;
64 => int e; 76 => int E; 88 => int hE;
65 => int f; 77 => int F; 89 => int hF;
66 => int fs; 78 => int Fs; 90 => int hFs;
67 => int g; 79 => int G; 91 => int hG;
68 => int gs; 80 => int Gs; 92 => int hGs;
69 => int a; 81 => int A; 93 => int hA;
70 => int as; 82 => int As; 94 => int hAs;
71 => int b; 83 => int B; 95 => int hB;
[
[B,2],[Fs,2],[D,1],[Fs,2],[b,5],
[B,2],[A,2],[B,2], [Fs,2],[D,1],[Fs,2],[b,5],
[B,2],[hCs,2],[hD,2],[hCs,1],[hD,2],[hD,2],[B,1],
[hCs,2],[B,1],[hCs,2],[hCs,2],[A,1],[B,2],[A,2],[B,1],[Fs,2],[B,5],
[B,2],[A,2],[B,2],[Fs,2],[D,1],[Fs,2],[b,5],
[B,2],[A,2],[B,2],[Fs,2],[D,1],[Fs,2],[b,5],
[B,2],[hCs,2],[hD,2],[hCs,1],[hD,2],[hD,2],[B,1],
[hCs,2],[B,1],[hCs,2],[hCs,2],[A,1],[B,2],[A,2],[B,1],[hCs,2],[hD,5],
[hD,2],[hE,2],[hFs,2],[hD,2],[A,1],[D,2],[Fs,5],
[hFs,2],[hE,2],[hFs,2],[hD,2],[A,1],[hD,2],[Fs,5],
[hFs,2],[hGs,2],[hA,2],[hGs,1],[hA,2],[hA,2],[hFs,1],
[hGs,2],[hFs,1],[hGs,2],[hGs,2],[hE,1],[hFs,2],[hE,2],[hFs,1],[hD,2],[hFs,5]
] @=> int melody[][];
120::ms => dur delay;
for( 0 => int k; k < 2; k++) {
for( 0 => int i; i < melody.cap(); i++) {
if ( melody[i][0] > 0 ) {
Std.mtof( melody[i][0] - 16 ) => s.freq;
}
for( 0 => int j; j < 10; j++) {
(10-j)/10.0 => s.gain;
delay/10.0 => now;
}
0.0 => s.gain;
delay*(melody[i][1]-1) => now;
}
}