osc events in supercollider

Nikolaus Gradwohl2009-03-08T17:18:00+00: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
Tweet This! submit to reddit Digg! Tags: | 2 comments | no trackbacks

See also:

SuperCollider on Linux
sketch experiment 7 - osc events
SuperCollider drumsample generator
Volca Sample SuperCollider Drum Set
music live-coding environments - my first impressions

Trackbacks

Comments

Leave a response

  1. Macario Ortega 2009-08-31T06:24:51+00:00

    Hi, you may want to check my SuperCollider client for Ruby, heres an example of a SynthDef:

      SynthDef.new :fm do |freq, amp, dur|
        mod_env = EnvGen.kr Env.new( d(600, 200, 100), d(0.7,0.3) ), 1, :timeScale => dur
        mod     = SinOsc.ar freq * 1.4, :mul => mod_env
        sig     = SinOsc.ar freq + mod
        env     = EnvGen.kr Env.new( d(0, 1, 0.6, 0.2, 0.1, 0), d(0.001, 0.005, 0.3, 0.5, 0.7) ), 1, :timeScale => dur, :doneAction => 2
        sig     = sig * amp * env
        Out.ar  0, [sig, sig]
      end.send
    
      camp = Synth.new :fm, :freq => 220, :amp => 0.4, :dur => 1
    
  2. Macario 2009-08-31T06:27:29+00:00

    Sorry, the url: http://github.com/maca/scruby

Leave a comment