[chuck-users] live coding: methods and motivations

Scott Wheeler wheeler at kde.org
Tue Sep 18 23:29:35 EDT 2007

robin.escalation wrote:
> Scott Wheeler wrote:
>> The main thing this boils down to from my side is doing controlled 
>> randomization, parameter envelopes or event sequences that are too 
>> complicated or tedious to do directly in the sequencer.
> I can see doing that myself. For the last couple of years I have been
> using Reaktor to build instruments that generate sound through simple
> interaction... no complex sequencing. For example I slow a drum
> machine to 2 BPM and run the hits through a resonant filter and
> delay, with one or two LFOs cycling some parameters. This might
> create odd popping an chirping sounds at randomish intervals.
> This is all well and good, but the only algorithmic devices I've used
> have been made by other people, since Reaktor is not the best
> environment for writing equations. That said, I would rarely want to
> simply feed and equation and watch it run.
> What is great about Reaktor is that it is easy for me to "play" these
> instruments in real time, since any of their parameters can be
> exposed to controls and mapped with MIDI. So I am able to jam with my
> creations with some sound factors under strict control, others
> wandering, and still others directly played.

Well, you can also map stuff to MIDI in ChucK, you just have to build a 
few classes to make the setup easy.  I've attached an example built on 
my collection of classes.  (Most of which are hacked out of a recent set.)

Once the base classes are there (which shouldn't ever need to be 
changed, really), this gives you a way to map functionality to a 
hardware MIDI control either based on subclassing:

class FooControl extends Control
    1 => cc;

    fun void set(int value)
        <<< "Foo: ", value >>>;

FooControl foo;

Or events:

EventControl bar;
2 => bar.cc;

fun void listener()
        bar.changed => now;
        <<< "Bar: ", bar.changed.value >>>;

spork ~ listener();

Combined with the dummy code I inserted below that to simulate a knob 
and then a button we get:

localhost: /Users/scott/Documents/ChucK> chuck Control.ck
Foo:  0
Bar:  127
Foo:  1
Foo:  2
Foo:  3
Foo:  4
Foo:  5
Foo:  6
Foo:  7
Foo:  8
Foo:  9

-Scott (aka Self Appointed ChucK Algorithms Wonk)

Extra Credit:  One thing that I've noticed in a couple of places is that 
sometimes sporking doesn't do what I would expect it to.  For instance, 
if I change line 223 to "spork ~ node.item.set(value);" to make it 
non-blocking the program doesn't work.  I don't see why.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Control.ck
Url: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20070919/1c1b0be5/attachment.bat 

More information about the chuck-users mailing list