Chuck iControl Projectpage

Nikolaus Gradwohl2008-07-14T06:46:00+00:00

as written before, i have started writing a chuck script that mapps the midi-data from my iControl to OSC events. I now have set up a proper project page for the script.

read more ...

Processing OSC

Nikolaus Gradwohl2008-07-04T06:23:00+00:00

I have recently posted about my chuck-script that generates osc events from my m-audio iControl. Now i have written a Processing-sketch, that visualizes the events. The OSC-Events are parsed using the oscP5.

import oscP5.*;
import netP5.*;

OscP5 oscP5;
int buttons[] = {0,0,0,0,0,0,0,0};
float knobs[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

void setup() {
size(500,500);
frameRate(25);
background( 0 );
oscP5 = new OscP5( this, "239.0.0.1", 3334 );
}

void draw() {
drawControl();
}

void drawControl() {
smooth();
ellipseMode( CORNER );
for (int i = 0; i < 8; i++ ) {
    fill( 255 * buttons[i] );
    stroke( 255 );
    ellipse( 10, 20 + i * 20, 15, 15 );

    fill( 0 );
    rect( 40, 20 + i * 20, 100, 15 );  
    noStroke();
    fill( 0, 0, 128 );
    rect( 41, 21 + i * 20, 99 * knobs[i], 14 );  

}
}

void oscEvent( OscMessage m ) {
print( " pattern " + m.addrPattern());
println( " type " + m.typetag());
if (m.addrPattern().equals( "/icontrol/button" )) {
    int chan = m.get(0).intValue();
    int val = m.get(1).intValue();
    buttons[chan] = val;
} else if ( m.addrPattern().equals( "/icontrol/knob")) {
    int chan = m.get(0).intValue();
    float val = m.get(1).floatValue();
    knobs[chan] = val;
}
}
read more ...

chuck icontrol

Nikolaus Gradwohl2008-05-22T18:04:00+00:00

I own a m-audio icontrol and some time ago i started to play with chuck a programming language for making electronic music. today i managed to link them together and use my icontrol to start and stop my chuck programms :-)

next thing i will try is to convert the values from the "endless"-knobs to floats and to pass messages to the sub programms

1 => int device;

MidiIn min;
MidiOut mout;
MidiMsg msg;

// open the device
if( !min.open( device ) ) me.exit();
if( !mout.open( device ) ) me.exit();
[0,0,0,0,0,0,0,0] @=> int on[];
[-1, -1, -1, -1, -1, -1, -1, -1] @=> int ids[];
["beep.ck", "sing.ck", "autoloop.ck", "", "", "", "", "" ] @=> string names[];
while ( true ) {
    min => now;

    // get the message(s)
    while( min.recv(msg) ) {
        // print out midi message
        <<< msg.data1, msg.data2, msg.data3 >>>;

        if ( msg.data1 == 176 && msg.data2 >= 64 && msg.data2 < 72 && msg.data3 == 127 ) {
            msg.data2 - 64 => int chan;
            if ( on[chan] == 1 ) {
                0 => on[chan];
                sendOff( chan );
                if (ids[chan] > 0) {
                    Machine.remove( ids[ chan ] )
                        -1 => ids[chan];
                    }
                } else {
                    1 => on[chan];
                    sendOn( chan );
                    if ( names[chan] != "" ) {
                        Machine.add( names[chan] ) => ids[chan];
                    }
                }
            }
            // send( msg.data1, msg.data2, msg.data3 );
        }
    }

    fun void sendOn( int chan ) {
    send( 176, 64 + chan , 127 );
    }

    fun void sendOff( int chan ) {
    send( 176, 64 + chan, 0 );
    }

    fun void send( int d1, int d2, int d3 ) {
        MidiMsg msg;
    d1 => msg.data1;
    d2 => msg.data2;
    d3 => msg.data3;
    mout.send( msg );
    }
read more ...