electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » DIY Hardware and Software » ChucK programming language
Popcorn for Chuck!
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Icetron



Joined: Oct 21, 2007
Posts: 3
Location: Nebraska, USA

PostPosted: Sun Oct 21, 2007 1:59 pm    Post subject: Popcorn for Chuck! Reply with quote  Mark this post and the followings unread

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 Very Happy

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
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Mon Oct 22, 2007 2:59 am    Post subject: Re: Popcorn for Chuck! Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Mon Oct 22, 2007 4:44 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
Icetron



Joined: Oct 21, 2007
Posts: 3
Location: Nebraska, USA

PostPosted: Tue Oct 23, 2007 9:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use