[chuck-users] Hello, some newbie questions

Michael Heuer heuermh at gmail.com
Tue Oct 5 10:58:43 EDT 2010


Mat Schaffer:

> I've been playing with chuck for a couple weeks and am having a lot of fun
> with it. Really cool environment and I was impressed how easy it was to set
> up the MIDI stuff.
>
> After reading over a lot of material though, I still couldn't answer a few
> questions, so I thought I'd try the list.
>
> - Is there any way to have a script load it's own dependencies? I tried
> Machine.add which is listed on http://github.com/heuermh/lick/wiki, but it
> doesn't seem to work. Here's the code I'm trying:
> http://gist.github.com/611486

No, you have to determine the dependencies and dependency order by
hand.  This is my number one feature request, to have a proper
namespace and import mechanism.


> - Similar to the last question, when I do load both of the above files into
> chuck at once, it seems like only the class ends up in the global space. Is
> there any way share raw functions or variables between files? The reason I
> want to do this is mostly to avoid having to do timing code like
> this http://gist.github.com/611515, or note definitions (cs, Cs) in every
> file. Something like a pre-processor include would probably do the trick.

Only public classes are shared.  You can add static fields & methods
to public classes.


> - Is there a way to pass functions as arguments to another function or
> return a function? Also, are fun's proper closures or am I just getting
> lucky? I was thinking maybe I could use functional style programming to
> build things like arpeggiations. If this is totally overkill let me know :)

No.  As you may have seen, LiCK uses functors to approximate function
arguments/closures.  Feature request #2.  :)


> - The SinOsc seems to click whenever I stop or disconnect it. I've tried
> moving the gain to 0.1, then 0, but it still seems to click. Is there some
> technique for avoiding this?
>
> Thanks in advance for your help. Looking forward to spending more time with
> ChucK in the future.

Welcome!

   michael


More information about the chuck-users mailing list