Author |
Message |
Icetron
Joined: Oct 21, 2007 Posts: 3 Location: Nebraska, USA
|
Posted: Sun Oct 21, 2007 1:59 pm Post subject:
Popcorn for Chuck! |
|
|
First off I'd like to say that chuck is an amazing program.
I saw a request for techno on the Chuck wiki, so I slapped together a poor version of Popcorn
Code: |
// Triangular Popcorn - A poor version of Popcorn in chuck.
// Copyright (C) 2007 Ryan Henszey <henszey>
// 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>.
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> int i; i <melody> 0 ) {
Std.mtof( melody[i][0] - 16 ) => s.freq;
}
for( 0 => int j; j <10> s.gain;
delay/10.0 => now;
}
0.0 => s.gain;
delay*(melody[i][1]-1) => now;
}
}
|
|
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Mon Oct 22, 2007 2:59 am Post subject:
Re: Popcorn for Chuck! |
|
|
Icetron wrote: | Code: |
for( 0 => int k; k <2> int i; i <melody> 0 ) {
|
|
I got the following error when I ran it:
[popcorn.ck]:line(50).char(28): parse error
Something doesn't look right about that for loop. I would like to hear the song though! :) |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Mon Oct 22, 2007 4:44 am Post subject:
|
|
|
Maybe HTML is switched on? ChucKists should switch HTML off in either their profile or in the posting settings, IMHO this is a error in PHPBB, the board should leave everything within a code-tag be.
Welcome on board Icetron! _________________ Kassen |
|
Back to top
|
|
|
Icetron
Joined: Oct 21, 2007 Posts: 3 Location: Nebraska, USA
|
Posted: Tue Oct 23, 2007 9:34 pm Post subject:
|
|
|
Yup it looks like html tags, reposted and tested:
Code: |
// 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;
}
}
|
|
|
Back to top
|
|
|
|