Android Monome-Clone in Processing

Nikolaus Gradwohl2011-04-28T05:23:03+02:00

Processing 1.5 is the first released version that supports the android mode in processing. So I wrote a simple monome-clone in processing to test it.

Download the complete source here if you want to try it yourself.

The sketch uses the OscP5 library to generate or react to osc-messages, but unfortenatly processing still has problems resolving external libraries in android mode. So I added the oscp5.jar to the sketch using "Add File" - works like a charm.

The sketch is far from perfect - the target address of the osc events is still hardcoded, no support for multitouch events yet, etc - but its really nice to see how fast an android app can be made with processing

This is my Archos 101 running the my monome-clone

android monome clone

read more ...

Mapping linux input events to OSC

Nikolaus Gradwohl2009-09-06T04:48:00+02:00

In linux every input device registers under /dev/input/eventX and sends events in 16 byte blocks. these data chunks contain a timestamp the event type, the event code and a value depending on the event type the semantic of value changes. for a event type 1 (key event) value 1 means pressed and value 0 mean released.

here is a little ruby program that reacts to key press events and sends osc messages. which could trigger drum sounds, start play back, ...

key press events are not only sent by keyboards but also by mice, joystics, gamepads, a DDR mat, a buzz buzzer, ...

the code example is used to map keys of my PS3 Controller to drum sounds.

require 'osc';

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" )

File.open("/dev/input/event7") do |f|
  while true
    event = f.read(16).unpack("llSSl")
    time = event[0] + event[1] / 1000000.0
    type = event[2]
    code = event[3]
    value = event[4]

    puts "Ti: #{time} T: #{type} C: #{code} V: #{value} " if type == 1

    c.send( bd, 0, 'localhost', 3334 ) if type == 1 && code == 298 && value == 1
    c.send( sn, 0, 'localhost', 3334 ) if type == 1 && code == 293 && value == 1
    c.send( hh, 0, 'localhost', 3334 ) if type == 1 && code == 303 && value == 1
  end
end

The code was inspired by 2 articles i found recently the first one is about how to use a DDR-mat to trigger Drum Sounds and the second one shows how to read the accelerometer data from a openmonoko phone

read more ...

cocoa osc app

Nikolaus Gradwohl2009-04-14T05:14:00+02:00

i just wrote a cocoa frontend for my ruby osc sequencer using vvosc.

vvosc test

this is a simple tutorial to show how i got my vvosc app running. i'm neither a xcode nor objective-c expert - so be gentle if there are some mistakes, or there is a simpler more xcody way to do it :-)

read more ...

ruby osc seqencer version2

Nikolaus Gradwohl2009-04-13T14:57:00+02:00

i updated my osc sequencer in ruby. now it doesn't just send osc events but also react to it. i made a small processing sketch that sends osc play,pause,stop events for each track in the sequencer. i also refactored the ruby code a bit, to use classes. next steps i plan are to separate the sequencer code from the sequences and allow sequences to be added or deleted at runtime via osc messages.

the code isn't very reusable now, so i still considere this more as a prove of concept, but i like the idea of separating the frontend and the backend via osc events and having sequences that can run independently.

that should enable some nice osc controlled audio/video installations.

write me a comment or mail if you have some ideas for improvement or if you use the code in one of your projects

read more ...

osc linkdump

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

http://opensoundcontrol.org the mother of all osc pages ;-)

http://nodebox.net/code/index.php/OSC osc support in NodeBox a programming environment based on python - with strong processing influences

http://hans.fugal.net/src/rosc/ osc support for ruby

http://www.ixi-audio.net/content/body_backyard_python.html simple osc library for python

http://frey.co.nz/projects/ofxosc/ osc library for openframeworks

http://www.audiomulch.com/~rossb/code/oscpack/ osc library for c++. is used by ofxosc

http://www.sojamo.de/libraries/oscP5/ osc library for processing

http://chuck.cs.princeton.edu/doc/language/event.html chuck osc documentation

http://www.local-guru.net/blog/2009/03/06/osc-events-in-pd osc events in puredata

http://supercollider.svn.sourceforge.net/viewvc/supercollider/trunk/build/Help/ServerArchitecture/Server-Command-Reference.html supercollider osc command reference

http://supercollider.svn.sourceforge.net/viewvc/supercollider/trunk/build/Help/Control/OSCresponderNode.html supercollider OSCresponderNode documentation

http://mtg.upf.edu/reactable/?tuio osc based protocol for tangiable user interface

http://wiki.monome.org/view/40hOscProtocol the monome protocol

http://www.grahamwakefield.net/MAT-F04/233/index.html 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 = EnvGen.kr(env, 1, doneAction:2);

        Out.ar([0,1], SinOsc.ar( mfreq.midicps ) * amp * 0.5);
    }).send(s);
)

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

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

bge-cube.png

the blend file can be downloaded here

the blend file needs OSC.py 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]).
-export([start_server/0]).
-include("server_config.hrl").

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

loop(Socket) ->
    receive
        {udp, Socket, Host, Port, Bin} ->
            Adr = binary_to_list(util:getadr(Bin)),
            io:format( "got: ~p~n", [{Host, Port, Adr}]),
            Dispatch:dispatch( Adr, Bin ),
            loop(Socket)
    end.
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.

osc-patch

pd-osc-patch.pd

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