window resizing in processing

Nikolaus Gradwohl2009-03-08T19:50:00+01:00

The following processing code shows how to resize a processing window from your code. the resizeApp methdo calculates the difference between the frame size and the size of the actual drawing area and adds it to the new size. then the application-frame is resized.

void setup() {

int col = 0;

void draw() {
  line(0,0,width, height);

void mousePressed() {
  if (col == 0) {
    resizeApp( 640, 400 );
    col = 255;
  } else {
    resizeApp( 320, 200 );
    col = 0;

void keyPressed() {

void resizeApp( int w, int h ) {
  int delta = frame.getHeight()-height;
   resize( w, h );
   frame.setSize( w, h + delta );
read more ...

osc linkdump

Nikolaus Gradwohl2009-03-08T17:37:00+01:00 the mother of all osc pages ;-) osc support in NodeBox a programming environment based on python - with strong processing influences osc support for ruby simple osc library for python osc library for openframeworks osc library for c++. is used by ofxosc osc library for processing chuck osc documentation osc events in puredata supercollider osc command reference supercollider OSCresponderNode documentation osc based protocol for tangiable user interface the monome protocol java based osc sequencer

read more ...

osc events in supercollider

Nikolaus Gradwohl2009-03-08T17:18:00+01:00

supercollider uses osc to controll the synthisizers internally, but i wanted a supercollider synth to react to my osc events instead of having to send supercollider-osc events from my app

after some research in the help files i found out that OSCresponderNode does the trick.

the code example shows how to register for an osc event and trigger a synth. now i can use a supercollidersynt with my ruby osc sequencer

    SynthDef( "guru2", { arg mfreq=40;
        var env, amp;

        env = Env.perc( 0, 0.2 );
        amp =, 1, doneAction:2);[0,1], mfreq.midicps ) * amp * 0.5);

n = NetAddr("", 57120)
o = OSCresponderNode(nil, '/melody', { |t, r, msg| Synth( "guru2", [\mfreq, msg[1]]);  }).add;

read more ...

using the BlenderGameEngine as OSC client

Nikolaus Gradwohl2009-03-08T15:18:00+01:00

i just managed to use the GameEngine of blender as a client for OSC events :-)

now i can change the color of a cube by sending osc events from my pd-patch or the ruby-script i wrote for my openframeworks-demo


the blend file can be downloaded here

the blend file needs by Daniel W. Holth to be in the python searchpath, so either copy it to location you start blender form or copy it to your site-package folder (obviously i'm not the only one who had the idea of using this lib with the blender game engine :-] )

read more ...

oscdispatch 0.1

Nikolaus Gradwohl2009-03-07T08:51:00+01:00

I finished the first version of my OSCDispatch server in erlang.

The program defines a generic server and uses a callback function for the dispaching rules.

the oscdispatch.erl looks like this and uses a parameter in the module definition

-module(oscdispatch, [Dispatch]).

start_server() ->
    spawn( fun() -> server(?server_port) end ).

server(Port) ->
    {ok, Socket} = gen_udp:open( Port, [binary] ),
    io:format( "socked opened ~p~n ", [Socket]),

loop(Socket) ->
        {udp, Socket, Host, Port, Bin} ->
            Adr = binary_to_list(util:getadr(Bin)),
            io:format( "got: ~p~n", [{Host, Port, Adr}]),
            Dispatch:dispatch( Adr, Bin ),
read more ...

Osc events in PD

Nikolaus Gradwohl2009-03-06T08:44:00+01:00

i have written an pd-patch to controll the simple openframeworks osc demo i wrote ealier today.



the hardest part in using osc with pd was getting a pd-version that supports osc. the deb packages for pd-extended don't work on unbuntu 8.10.

so i had to compile my own package using this instructions

read more ...

very simple OSC debug tool

Nikolaus Gradwohl2009-03-06T08:09:00+01: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.listen( "", 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+01: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 ="/color", "i", 128 )
c =
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 ...

Handassembled java bytecode

Nikolaus Gradwohl2009-03-03T04:25:00+01:00

motivated by my hand written x86 machinecode, i decided that i had to take it to the next level.

i worte some handassembled java bytecode. run the file below as

./ > HelloAsm 

and run the programm with

java HelloAsm
read more ...

Machine language Hello-World in 120 bytes

Nikolaus Gradwohl2009-02-25T05:37:00+01:00

a while ago i read the really cool tutorial on programming a pdp11. after typing the "hello world" example into the simulator, i startet to search for instructions how to write the machine code for the pdp11 myself.

after a while coding in raw octal numbers, i wanted to take it to the next level and searched for a way to write machine code by hand for my linux box

So i downloaded Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual and wrote a shell script that can be used to dump the raw machine code into a file. of course my dualcore-pentium-mega-bla processor in far more sophisticated than the pdp11 cpu was. so it can't be programmed in octal numbers - i used hexadezimal numbers :-)

execute the shellscript and pipe it into a file

sh > hello

make it executable and - TATAAAA - a hello world programm in 120 bytes (including the elf header - which adds 80 bytes all by himself)

# write a elf header in the file
echo -ne "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
echo -ne "\x02\x00\x03\x00\x01\x00\x00\x00\x54\x80\x04\x08\x34\x00\x00\x00"
echo -ne "\x80\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x01\x00\x28\x00"
echo -ne "\x03\x00\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80\x04\x08"
echo -ne "\x00\x80\x04\x08\x6f\x00\x00\x00\x6f\x00\x00\x00\x05\x00\x00\x00"
echo -ne "\x00\x10\x00\x00"

echo -ne "\x31\xc0"  # clear eax
echo -ne "\x50"  # push 0 on the stack
echo -ne "\x68rld\x0a"  # push the string onto the stack in reverse order, 4 bytes a time
echo -ne "\x68o Wo"
echo -ne "\x68Hell"

echo -ne "\x89\xe1"  # move stackpointer to ecx ( the start of our string )
echo -ne "\xb0\x04"  # move 4 to al ( eax is already 0 because auf line one )
echo -ne "\x33\xc3\xb3\x01"  # xor ebx and move 1 to bl
echo -ne "\x32\xc2\xb2\x0c"  # xor edx and move 12 onto dl (length of the string )
echo -ne "\xcd\x80"  # int 0x80
echo -ne "\xb0\x01"  # move 1 into al
echo -ne "\xcd\x80"  # int 0x80
read more ...