[chuck-users] dorkbot-chicago tomorrow

Graham Coleman gc at gehennom.net
Tue Apr 11 19:19:54 EDT 2006


Tom,

Thanks for checking out the tutorial and for excellent feedback.
More below:

On Mon, 10 Apr 2006, Tom Lieber wrote:

> On 4/10/06, Graham Coleman <gc at gehennom.net> wrote:
> Also, the tutorial that I was working on is in an almost-adequate state.
> I'd appreciate any suggestions on content, presentation, more reference to
> introductory materiel, etc:
>
> http://ravelite.org/chuck-notes/tutorial.html

> I've worked through it through 1.4.A, and two things have come up:

> 1) I wasn't sure how to use the scale.ck file, but after messing
> around (and checking the language spec for something like 'include') I
> tried "chuck scale tut01" and that got me going.

This is a good point, I added some execution notes to the tutorial. As I'm
pimping audicle style programming I should explain the basic functions
more.

To confirm, right now chuck doesn't have something like a classpath or
include (and only the first defined class in a file is public), so you
have to send all of your source files to the VM separately.

> 2) The following code sounds weird when played, like it's missing a
> note somewhere near the end:

Scale sc; // The provider of scales
StifKarp inst => dac;
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] @=> int mel[];

for(0 => int i; ; i++){
        std.mtof ( 12*4 + sc.scale ( mel[i % mel.cap ()], sc.maj ) )
=> inst.freq;
        inst.noteOn(0.5);
        300::ms => now;
}

I executed this and I see what you mean, it plays two octaves, the top
note, and what seems like an extra second. But I think that's the correct
behavior. In the major scale, there are 7 non-repeated diatonic scale
tones:

first octave, second octave, 1st+2nd
[0,1,2,3,4,5,6] , [7,8,9,10,11,12,13], [14,15]

> 3) In the second to last code example there is "fun int arp(){}" with
> a return statement inside; I think it's meant to be "fun int arp".

Absolutely- fixed. Thanks for finding this.

> 4) What is the variable b in "arp( b/2, 7, [0,2,4] ) => int a;"? Is it
> supposed to be a call to b()?

Sometimes I store it in a local variable. One of my code tics.
Like:     tg.m(i) => int m; //measure indicator
Usually I do the same thing with b, calling tg.b(i) inline would work
(or any other custom timing scheme).

Thanks much,

Graham


More information about the chuck-users mailing list