very simple OSC debug tool

Nikolaus Gradwohl2009-03-06T08:09:00+00:00

when playing with OSC and i'm not quite sure what osc messages get send by an application i use a little python script which uses the simple OSC api

import osc
osc.init()
osc.listen( "127.0.0.1", 1234 )

in fact it misuses the library ;-)

every time a message is received that isn't bound by a callback function (which is all messages, since we dont bind anything here ), the listener prints a waring containing the address, the format and the value of the message

read more ...

osc app using openframeworks

Nikolaus Gradwohl2009-03-06T04:21:00+00:00

I have written a little demo app in openframeworks that shows how to react to osc events. Openframeworks uses ofxOsc as OSC library, which comes preinstalled in the FAT distribution.

the programm shows a square on a black background. the gray level of the square can be adjusted by sending osc messages to port 1234.

the following little ruby program sets the color to #808080

require 'osc'
msg = OSC::Message.new("/color", "i", 128 )
c = OSC::UDPSocket.new
c.send( msg, 0, "localhost", 1234 )

in the 'setup' method a osc receiver is initalized, and in the 'update' method, the messages are fetched from a queue and parsed.

I didn't generate any real complex osc messages for now, but as far as i can tell it is a very nice osc framework.

read more ...

osc sequencer in ruby

Nikolaus Gradwohl2009-01-20T05:29:00+00:00

I wrote a simple osc sequencer in ruby using rosc. The script triggers the drum-kit and the bass i implemented last week.

the pattern may also be of different length. This allows very interesting polyrythmic loops.

require 'osc'
Host = 'localhost'
Port = 3334

c = OSC::UDPSocket.new
hh = OSC::Message.new('/drum', 's', "hh" )
bd = OSC::Message.new('/drum', 's', "bd" )
sn = OSC::Message.new('/drum', 's', "sn" )

ba = OSC::Message.new('/bass', 'i', 64 )


#c.send sn, 0, Host, Port
bpm = 120
step = 1.0/8;
s = bpm * step / 60.0 ;

snd = [ bd, sn, hh ]
pattern = [
[1, 0, 0, 1, 0, 1, 0, 0 ],
[0, 0, 1, 0, 0, 0, 1, 1 ],
[1, 1, 1, 1, 1, 1, 1, 1 ]
]
bass = [
40, 40, 0, 40, 40, 0, 43, 0,
40, 40, 0, 40, 40, 0, 38, 0 ]

count = 0;
while(true)
    (0..2).each { |i|
        c.send(snd[i], 0, Host, Port) if pattern[i][count % pattern[i].length] == 1
    }

    ba.args = [bass[ count % bass.length]]
    c.send( ba, 0, Host, Port ) if bass[ count % bass.length ] != 0

    sleep s
    count+=1
end
read more ...

SuperCollider on Linux

Nikolaus Gradwohl2008-08-17T09:35:00+00:00

Today i have installed supercollider on my ubutu system following this instructions. SuperCollider is a environment and programming language for audio synthesis simliar to chuck. SuperCollider can run on a network and uses OSC events for comunication.

After looking around in the source tree i found a plugin for vim :-)

Installations is a bit quirky (the folders 'ftpplugin', 'syntax' and 'intend' needed to be copied to ~/.vim by hand) but now i can edit my sc code using my vim - veeeery cool :-)

single lines of code can be sent to the server using F6 codeblocks are sent to the server using F5.

s.boot
(
c = { arg f=900;
    var x;
    x = SinOsc.ar(f);
    x * 0.1
}.play;
)

c.set(, 400);
c.set(, 670);

to start te server the first line has to be sent to sclang (using F6). Then the code block starting line 2 is sent to the server (using F5)... tata - a sine wave.

sending the last 2 lines (F6 again) change the frequency of the running synth.

F12 can be used to turn all sounds off.

read more ...

Erlang OSC Dispatcher

Nikolaus Gradwohl2008-07-14T07:10:00+00:00

I have started a Project to write and osc message dispatcher in erlang. I want to use it to dispatch the data from my icontrol chuck script to other soundgenerating scripts or visualisation programms.

read more ...

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 ...