electro-music.org   Dedicated to experimental electro-acoustic
and electronic music
 
 Front Page  |  Radio  |  Forum  |  Media  |  Playlists  |  Wiki
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 
 Forum index » DIY Hardware and Software » ChucK programming language
ChucK ensemble ?
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 2 [42 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2 Next
Author Message
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Thu Sep 25, 2008 3:43 am    Post subject: ChucK ensemble ? Reply with quote  Mark this post and the followings unread

Hi,

Anyone interested of starting a ChucK ensemble, not (necessarily) livecoding but collaborative compositions using exclusively ChucK ?
I've outlined a proposal for a program or 'rules' under discussion if (at least) few people are interested.


-Jukka
Back to top
View user's profile Send private message Visit poster's website
cebec



Joined: Apr 19, 2004
Posts: 1105
Location: Virginia
Audio files: 3
G2 patch files: 31

PostPosted: Thu Sep 25, 2008 5:04 am    Post subject: Reply with quote  Mark this post and the followings unread

Absolutely great idea! I'm in...
Back to top
View user's profile Send private message
.dupion.



Joined: Jun 15, 2008
Posts: 2
Location: UK

PostPosted: Thu Sep 25, 2008 6:42 am    Post subject: Reply with quote  Mark this post and the followings unread

sounds good to me!

p.s. i probably should mention that i'm a complete beginner. maybe i could play the ChucK equivalent of the triangle or something?
p.p.s. don't feel obliged to accomodate me if its not in fitting with your idea Smile
Back to top
View user's profile Send private message
witt0191



Joined: Feb 13, 2008
Posts: 23
Location: UK

PostPosted: Thu Sep 25, 2008 6:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

me to sounds like a great idea
Back to top
View user's profile Send private message
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Thu Sep 25, 2008 10:17 pm    Post subject: Reply with quote  Mark this post and the followings unread

Great, at least a quartet ! Here is a program or 'rules' I've outlined,
let me know what you think:

Code:

Goal: writing ChucK programs together and independently
of others, collaborative compositions.

Rules:

1. Everything is done using exclusively by ChucK
2. Anyone can suggest a patch
3. Each participant makes one UGen of
the patch without being aware what others are doing.
No planning together !
(3. Max lines of source .ck is 40.)
(4. All music is monophonic, several sources can be run together.)
5. All finished sources are public-domain.



Items in parenthesis are optional, most important are 1. and 3., also 5.
Of course there are other options and variations for these, if you want to add/remove something and/or have other suggestions please do so.


-Jukka
Back to top
View user's profile Send private message Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Fri Sep 26, 2008 2:59 am    Post subject: Reply with quote  Mark this post and the followings unread

This is a nice rule for building compositions and ideas for the band ^_^
From that, we can extend more into many areas.
I'm in also.

Let's make up some more rules to give example ideas for compositions.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
cebec



Joined: Apr 19, 2004
Posts: 1105
Location: Virginia
Audio files: 3
G2 patch files: 31

PostPosted: Fri Sep 26, 2008 4:57 am    Post subject: Reply with quote  Mark this post and the followings unread

Sounds good (the rules) but how would we start and then handle the collection of code? Would everyone write a small ChucK program on their own and then submit it at a specified time, etc.?
Back to top
View user's profile Send private message
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Fri Sep 26, 2008 5:18 am    Post subject: Reply with quote  Mark this post and the followings unread

Great kijjaz, yes let's start with these, we can add more rules when/if needed.

Here's a small template:

Code:

//ChucK ensemble template

Ugen1 => Ugen2 => Ugen3 => dac;

//UGen1: by xxx1

//UGen2: by xxx2

//UGen3: by xxx3

//dac: by xxx4

while(true) {

        //dac: timing mechanism

}



Not too complicated, something where to start. I'm not sure of timing mechanism if it should be done by UGen1 writer (oscillator, impulse, noise generator, adc etc) or should it be done by dac-guy. I've tried to find a place to share the code, anyway basically I thought that each one will write his/her UGen and after we've all finished we build the whole program. If someone knows good online code editor or similar please let me know, I found few but not sure if they work properly. Here's one:


http://notebook.zoho.com


Sign up some username and we can share our code snippets. Other way would be just using email, both works for me.


-Jukka
Back to top
View user's profile Send private message Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Fri Sep 26, 2008 5:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Ohh.. so the codes are gonna be played simultaneously?
It must be cool to incoporate codes by many chuckers into one chuck file.
but there should also be a system to sync / make the codes interact..

this would depend on each composition.

for example, we can set up a center system that each member's code can sync with / obtain information.

there can also be arrays that contain messages,
especially for interaction between each system.
- - -

some example ideas:

we might define a Metronome class that the codes can access.
so we can easily sync all the patches.

sequencer array:
make a universal int seq[][];
that each member can add members to it to form sequences.
so i can do like...

seq.size() => int MyMelody1;
seq << [0, 1, 1, 0]; // add my new melody
// .. etc ..
seq[MyMelody1] << 2 << 0 << 0; // add more members to that melody.
- - -

but this will need more planning.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Kassen
Janitor
Janitor


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

PostPosted: Fri Sep 26, 2008 6:10 am    Post subject: Reply with quote  Mark this post and the followings unread

Code:
public class clock
    {
    static Event @ bang;
    static int pos;
    static dur period;
    static int pattern_length;
    }

new Event @=> clock.bang;
.8::second => clock.period;
16 => clock.pattern_length;

while(1)
  {
  clock.bang.broadcast();
  clock.period => now;
  ++clock.pos%pattern_length => clock.stp;
  }


...and the same for scales, melodies, etc, etc, etc. Probably some public static Gain's as well to function as system-wide mixing busses.

If we can agree on what we need it's all quite possible.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Fri Sep 26, 2008 6:26 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, UGen codes simultanously and any source codes (complete programs)
too if we want. My original idea was to avoid synchronizing UGens ("manually") , that's why rule 4. (all music is monophonic), I thought that each UGen would be built independently to others, the whole would be a kind of non-deterministic automaton which would run using Chuck's timing mechanism and let Chuck automatically take care of synchronizing the files (if we use multiply source files). UGen's would be dependent of each others only if coder wants it but he/she must figure out how to do it. But of course this was just what I thought first, we can change and add rules/features as much we want.


-Jukka
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


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

PostPosted: Fri Sep 26, 2008 6:44 am    Post subject: Reply with quote  Mark this post and the followings unread

jukka_k wrote:
My original idea was to avoid synchronizing UGens ("manually") , that's why rule 4. (all music is monophonic), I thought that each UGen would be built independently to others, the whole would be a kind of non-deterministic automaton which would run using Chuck's timing mechanism and let Chuck automatically take care of synchronizing the files (if we use multiply source files).


Are you sure you didn't mean to write "shred" where you wrote "UGen"? I suspect you made a typo there. A UGen is something like a SinOsc or Gain, you can't "manually sync" those; they are kept track of by the VM and ticked once every sample in a order dependant on the UGen graph (which is just a fancy word for "the way they are connected").

Typically people don't build UGens themselves as you need C/C++... that's beyond me right now though if Stephen would find the time to publish the tutorial he's been thinking about I'd be interested in giving it a go.

It's also quite possible to write a polyphonic section of music using just a single shred and a single UGen; LiSa has multiple voices in a single UGen.

I really suspect you are mistaken about a few of the words you are using or perhaps made a typo or two. Perhaps you could go over these last few posts and verify this is what you were meaning to say? Perhaps I'm misunderstand you completely?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cebec



Joined: Apr 19, 2004
Posts: 1105
Location: Virginia
Audio files: 3
G2 patch files: 31

PostPosted: Fri Sep 26, 2008 7:01 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, I had the feeling you meant 'shred', too.
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: 270

PostPosted: Fri Sep 26, 2008 8:11 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm in though I would like to have a more clearly defined code structure before going any further. I think that chaining UGens together as described in the original post was a good vague concept to get us started, but it won't work quite like that as Kassen points out. Let's set up something like the code snippet that Kassen wrote before we all go off and write incompatible code.

I could code one of my personal favorites, a Boolean Sequencer class. It might perhaps receive an event that says "one metronome note interval has passed" and then respond with an event that says "play a note" or "the frequency of the note is this".

Or I could call upon history and recode some favorites of the past, like Kijjaz's birds (I could give you the bird) or perhaps my motorcycle sound (bwaaaa whaaaa).

It might be good to have an enable/disable feature in the control section of the code so that something like a motorcycle only occurs at the beginning or end of the song, i.e. some master sequencing occurs rather than just chaos with no structure.

Also, what is this I keep seeing about "public class" whatever code? Is this new in the latest version of ChucK. I'm ashamed to say I didn't upgrade because I never use command line, only mini-audicle. Also, did mini-audicle ever get released with the new version of ChucK? If we're going to work together we need to all have the latest and greatest.

Great idea for building community! I'm in!

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
cebec



Joined: Apr 19, 2004
Posts: 1105
Location: Virginia
Audio files: 3
G2 patch files: 31

PostPosted: Fri Sep 26, 2008 8:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:
Also, did mini-audicle ever get released with the new version of ChucK? If we're going to work together we need to all have the latest and greatest.


I contacted Spencer about this a couple of weeks ago, since I, too, use miniAudicle, primarily. He said he was busy, now, but he would do his best to get to releasing it as soon as he could with various bug fixes and the latest version of ChucK incorporated.
Back to top
View user's profile Send private message
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Fri Sep 26, 2008 9:03 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, now I'm explaining this badly, I try this with (pseudo)code examples.
There's a game (at least here in Finland), you take a letter size paper or A4 in Europe, fold it to three parts. First player draws a head to first part of the paper and continues part of the neck to second part of the paper, next player draws a torso making lines to continue to third part and last player makes legs. As a result there's a human figure drawn by three people, usually funny (at least our kids liked the play). Same thing here, let's start patch like this:

Code:

SinOsc s => LPF filter => dac;


Needs three "players"/coders, first will done SinOsc, second low-pass filter and third will do dac (ie. timing with or without public class).

First coder makes a simple choice:

Code:

Std.rand2(60,88) => Std.mtof => s.freq;


If we do this in "chain" he/she announces that his part is finished and that he used freq parameter in his UGen. Player 2 makes his part, like:

Code:

if(s.last > 64) 200 => filter.freq;
else Std.rand2f(50,100) => filter.freq


or if he decides not to "synchronize" (bad choice of term from me) his UGen with first player then something like

Code:

Std.rand2f(100,200) => filter.freq;
Std.rand2f(0,2) => filter.Q;


Next he announces that he is finished and used freq parameter (and Q) and player three makes his/her choices of "synchronizing" his part, like

Code:

filter.Q()*400::ms => now;


in case he is "synchronizing", or

Code:

100::ms => now;


in case he is not.

The whole code would be something like:

Code:

SinOsc s => LPF filter => dac;

while(true) {
     //UGen1: by player 1
     Std.rand2(60,88) => Std.mtof => s.freq;

     //UGen2: by player 2
     Std.rand2f(100,200) => filter.freq;
     Std.rand2f(0,2) => filter.Q;

     //UGen3: by player 3
     filter.Q()*400::ms => now;
}



(Don't try this at home, at least I didn't Smile).

This is what I meant, what we are doing next, synchronizing timing by public class, running this with other program (or by itself) etc, is up to us,
all possibilities are open. Yes there are no way to sync UGen's (I didn't mean that, nor shred in this case), just poor choice of words from me.
Please let me know what you think, if this is stupid idea we can do something else or anything.


-Jukka
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


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

PostPosted: Fri Sep 26, 2008 9:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:

Also, what is this I keep seeing about "public class" whatever code? Is this new in the latest version of ChucK.


No... I can't even find it in the "VERSIONS" file, must be from 2004 or earlier....

It defines a class that's accessible from anywhere in the VM. "static" means that variable will be the same for all instances of that class. This means that after running my example above you can use;
Code:

clock.bang => now;


in any other shred and all of those will be synced up. Because you can also change the duration of a step by going
Code:

.4::second => clock.period;


from anywhere in the VM all of those shreds will change their tempo so this is more powerful then
Code:

period - (now % period) => now;


Notice that static non-primitive members need to be instantiated outside of the class or there will be trouble.

This is a essential technique for being able to communicate between shreds that come from different files (and so don't share name-space). The only other way to do that would be using OSC but that means loosing strong timing; network messages aren't realtime; there is no guarantee that they will be processed within a certain amount of time (actually there is no guarantee that they will arrive at all). ChucK's Event structure on the other hand *is* realtime, or at least as realtime as the underlying OS will allow a program to be.


Quote:
I'm ashamed to say I didn't upgrade because I never use command line, only mini-audicle. Also, did mini-audicle ever get released with the new version of ChucK? If we're going to work together we need to all have the latest and greatest.


I know that for Linux ripping out the old ChucK from the Mini's source, inserting the latest ChucK source and compiling will work. This isn't harder then a normal compile. I didn't try that on Windows or OSX but my bet is that that will work as well.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kassen
Janitor
Janitor


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

PostPosted: Fri Sep 26, 2008 9:11 am    Post subject: Reply with quote  Mark this post and the followings unread

Jukka; got it! Thanks for clarifying.

One more note; "dac" is really quite limited in what you can do with it. Assuming you aren't allowed to re-/ dis- connect UGens then dac will only allow you to modulate it's .gain(). I suppose that may be interesting but all normal UGens allow that as well so...

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Fri Sep 26, 2008 9:20 am    Post subject: Reply with quote  Mark this post and the followings unread

Great Kassen, this is just my poor explaining, especially when I'm enthusiastic, this doesn't happen first time in my life Smile. Yes dac is limited, that's why he will get timing (and/or something else, it depends what we decide). We may re-/disconnect any UGen's, I can't see any reason why not.
Maybe starting from something simple is good first, things usually gets more complicated later.


-Jukka

Last edited by jukka_k on Fri Sep 26, 2008 10:03 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


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

PostPosted: Fri Sep 26, 2008 9:34 am    Post subject: Reply with quote  Mark this post and the followings unread

Cool, I like this game idea.
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


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

PostPosted: Fri Sep 26, 2008 9:57 am    Post subject: Reply with quote  Mark this post and the followings unread

Here in the US, at least when I was in college, we'd write "cycle stories", great fun! First person gets small electric typewriter (tool of the 80's) and types in a few sentences as the beginning of the story, pass it around and each player types whatever they feel like. Gets really funny as the night and the drinking go on...

I'm in for cycle ChucK. I did think, however, based on the thread title that you meant we would make a song with each of us contributing an instrument or somesuch. I suppose in Cycle ChucK we would have to add lots of silly comments to make it funny as well. We could just post the code to this thread instead of emailing it, perhaps?

Kassen, thanks for the public / static tutorial. I don't quite get it yet but it will sink in with time. I get that you make a class and then the machine sets aside these static variables for it, then every instance of the class accesses the same shared variables, so it facilitates inter-shred communication. It just hasn't become intuitive yet and I'm one who is dazed and confused for a while until he gets it, then i'm good to go. So let it percolate.

Let's give Cycle ChucK a try!

_________________
"Let's make noise for peace." - Kijjaz
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: Fri Sep 26, 2008 10:18 am    Post subject: Reply with quote  Mark this post and the followings unread

Les (re;Class),

Yes, that's basically right. Most of this (and a bit more) is covered in the manual as well, I think.

Note that when we are referring to a static member there is no need to instantiate the class as static members aren't unique to instances and instead belong to the class itself. This is why I didn't capitalise "clock" above. I didn't plan on ever having a shred go;
Quote:

Clock clock;


you can directly go to;
Code:

while(1)
    {
    clock.bang => now;
    if ( !(clock.pos % 4) ) kickdrum.play(1);
//imagine "kickdrum" is something we already defined
    }


Note that "clock" here *only* has static members.

If we want to keep all code in a single file for this then there is no need for such tricks but they do become important in multi-file constructs and they can be important if you want to update just a section of a structure while leaving the rest be, for example updating a instrument while keeping it's melody running so it'll pick up again once the updated code is executed.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


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

PostPosted: Fri Sep 26, 2008 10:57 am    Post subject: Reply with quote  Mark this post and the followings unread

thank you Kassen, you are helpful and pleasant as always.

Enough Talk! Time to ChucK this one! I begin with a simple woo-woo sound and some comments to facilitate my preferred code structure. You may of course, ChucK that and do whatever you want! Here's the code:


Cycle_ChucK1.ck
 Description:
Starting with a bang! Well, a woo-woo anyway.

Download (listen)
 Filename:  Cycle_ChucK1.ck
 Filesize:  377 Bytes
 Downloaded:  259 Time(s)


_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
cebec



Joined: Apr 19, 2004
Posts: 1105
Location: Virginia
Audio files: 3
G2 patch files: 31

PostPosted: Fri Sep 26, 2008 11:31 am    Post subject: Reply with quote  Mark this post and the followings unread

ok, how do we determine the order of the participants, though? 5 of us could be working on the same initial code simultaneously...
Back to top
View user's profile Send private message
jukka_k



Joined: Sep 17, 2008
Posts: 22
Location: Finland

PostPosted: Fri Sep 26, 2008 11:45 am    Post subject: Reply with quote  Mark this post and the followings unread

How about this:

http://notebook.zoho.com


username: chuckensemble
password: chen88

There's Cycle #1 which I just wrote, mark your name to code,
I took Pan2, anyway don't show your code, who takes SinOsc,
just tell to JCRev when you're ready and tell too which parameters
you used, JCRev to Pan2 (me), me to dac-person, after we all are ready just fill your code and first is done.

Hope this works, let me know.


-Jukka
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 2 [42 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2 Next
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
Log in
Username:     Password:      Log me on automatically each visit    


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2026 by electro-music.org