|
View:
New views
17 Messages
—
Rating Filter:
Alert me
|
|
|
[OSC] Bind custom vars to Ugen parameters with oscHi,
i have not found how can i bind my controllable variable to the ugens arguments created in scsynth. i mean not to use sclang (but JCollider), so i have to find a way to do this with osc messaging. How can i do? |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscJCollider has a Node and a Synth class that are very similar to the
classes with the same names in sclang, so setting node controls is practically the same. You might want to read their respective help files in SC3. Am 08.07.2008 um 17:35 schrieb kapitan: > > Hi, > > i have not found how can i bind my controllable > variable to the ugens arguments created in scsynth. > > i mean not to use sclang (but JCollider), > so i have to find a way to do this > with osc messaging. > > How can i do? > -- > View this message in context: http://www.nabble.com/-OSC--Bind- > custom-vars-to-Ugen-parameters-with-osc-tp18342114p18342114.html > Sent from the Supercollider - User mailing list archive at Nabble.com. > > > > _______________________________________________ > sc-users mailing list > > info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/ > MusicTechnology/880 > archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ > search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscBut this is my example in sclang: ( SynthDef("tutorial-args", { arg freq = 440, out = 0; Out.ar(out, SinOsc.ar(freq, 0, 0.2)); }).send(s); ) x = Synth("tutorial-args"); // no args, so default values y = Synth("tutorial-args", ["freq", 660]); // change freq z = Synth("tutorial-args", ["freq", 880, "out", 1]); Are freq and out an Ugen.ir(something) in the definition of the JCollider Synthdef? That is, have not understand that, cause JCollider doesn't have function i don't know how to declare vars. Sorry i'm a newbie :) |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscok, so you want to build synthdefs with jcollider, not just control
existing synths. below is an example, you see this is much more effort than sclang, and in particular SynthDef composition is not what jcollider was created for. so you need to instantiate a Control UGen. As Synth is missing a two argument constructor (could go on the feature-request-list), i'm using Synth.head here for brevity. import de.sciss.jcollider.*; public class Test { public static void main( String[] args ) { try { UGenInfo.readBinaryDefinitions(); Server s = new Server( "default" ); s.start(); Control ck = Control.kr( new String[] { "freq", "out" }, new float [] { 440f, 0f }); new SynthDef( "tutorial-args", UGen.ar( "Out", ck.getChannel ( "out" ), UGen.ar( "*", UGen.ar( "SinOsc", ck.getChannel( "freq" )), UGen.ir( 0.2f )))).send( s ); s.sync( 4f ); Group g = s.asTarget(); Synth x, y, z; x = Synth.head( g, "tutorial-args" ); // no args, so default values Thread.sleep( 1000 ); x.free(); y = new Synth( "tutorial-args", new String[] { "freq" }, new float [] { 660 }, g ); // change freq Thread.sleep( 1000 ); y.free(); z = new Synth( "tutorial-args", new String[] { "freq", "out" }, new float[] { 880, 1 }, g ); Thread.sleep( 1000 ); z.free(); System.exit( 0 ); } catch( Exception e1 ) { e1.printStackTrace(); System.exit( 1 ); } } } Am 08.07.2008 um 19:03 schrieb kapitan: > > > Sciss wrote: >> >> JCollider has a Node and a Synth class that are very similar to the >> classes with the same names in sclang, so setting node controls is >> practically the same. You might want to read their respective help >> files in SC3. >> > > But this is my example in sclang: > ( > SynthDef("tutorial-args", { arg freq = 440, out = 0; > Out.ar(out, SinOsc.ar(freq, 0, 0.2)); > }).send(s); > ) > > x = Synth("tutorial-args"); // no args, so default values > y = Synth("tutorial-args", ["freq", 660]); // change freq > z = Synth("tutorial-args", ["freq", 880, "out", 1]); > > Are freq and out an Ugen.ir(something) in > the definition of the JCollider Synthdef? > > That is, have not understand that, cause JCollider > doesn't have function i don't know how to declare > vars. > > Sorry i'm a newbie :) > > > > -- > View this message in context: http://www.nabble.com/-OSC--Bind- > custom-vars-to-Ugen-parameters-with-osc-tp18342114p18343822.html > Sent from the Supercollider - User mailing list archive at Nabble.com. > > > > _______________________________________________ > sc-users mailing list > > info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/ > MusicTechnology/880 > archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ > search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscp.s. there are other language possibilities. i have started to
examine Scala which is a very nice language in that it is statically typed but has large type inference mechanism so you effectively save a lot of typing, plus generics (well, you've got them in java 1.5) plus closures (well, you might get them in java 1.7), and you can access any standard java class without fuss. here's is how it would look in scala: import de.sciss.tint.sc._ import de.sciss.tint.sc.Predef._ val s = new Server( "default" ) val df = SynthDef( "test3", { "out" kr 0; "freq" kr 440; "amp" kr 0.5f; Out.ar( "out", SinOsc.ar( "freq" ) * "amp" )}) df.send( s ) val x = Synth.spawn( "test3" ) x.free val y = Synth.spawn( "test3", List( "freq" -> 666 )) y.free val z = Synth.spawn( "test3", List( "freq" -> 333, "out" -> 1 )) z.free so despite being a typed language, you come pretty close to the brevity of sclang code. ciao, -sciss- Am 08.07.2008 um 19:50 schrieb Sciss: > ok, so you want to build synthdefs with jcollider, not just control > existing synths. below is an example, you see this is much more > effort than sclang, and in particular SynthDef composition is not > what jcollider was created for. so you need to instantiate a > Control UGen. As Synth is missing a two argument constructor (could > go on the feature-request-list), i'm using Synth.head here for > brevity. > > import de.sciss.jcollider.*; > > public class Test { > public static void main( String[] args ) { > try { > UGenInfo.readBinaryDefinitions(); > Server s = new Server( "default" ); > s.start(); > > Control ck = Control.kr( new String[] { "freq", "out" }, new float > [] { 440f, 0f }); > new SynthDef( "tutorial-args", UGen.ar( "Out", ck.getChannel > ( "out" ), UGen.ar( "*", UGen.ar( "SinOsc", ck.getChannel > ( "freq" )), UGen.ir( 0.2f )))).send( s ); > s.sync( 4f ); > > Group g = s.asTarget(); > Synth x, y, z; > x = Synth.head( g, "tutorial-args" ); // no args, so default values > Thread.sleep( 1000 ); > x.free(); > y = new Synth( "tutorial-args", new String[] { "freq" }, new float > [] { 660 }, g ); // change freq > Thread.sleep( 1000 ); > y.free(); > z = new Synth( "tutorial-args", new String[] { "freq", "out" }, > new float[] { 880, 1 }, g ); > Thread.sleep( 1000 ); > z.free(); > System.exit( 0 ); > } catch( Exception e1 ) { > e1.printStackTrace(); > System.exit( 1 ); > } > } > } > > > Am 08.07.2008 um 19:03 schrieb kapitan: > >> >> >> Sciss wrote: >>> >>> JCollider has a Node and a Synth class that are very similar to the >>> classes with the same names in sclang, so setting node controls is >>> practically the same. You might want to read their respective help >>> files in SC3. >>> >> >> But this is my example in sclang: >> ( >> SynthDef("tutorial-args", { arg freq = 440, out = 0; >> Out.ar(out, SinOsc.ar(freq, 0, 0.2)); >> }).send(s); >> ) >> >> x = Synth("tutorial-args"); // no args, so default values >> y = Synth("tutorial-args", ["freq", 660]); // change freq >> z = Synth("tutorial-args", ["freq", 880, "out", 1]); >> >> Are freq and out an Ugen.ir(something) in >> the definition of the JCollider Synthdef? >> >> That is, have not understand that, cause JCollider >> doesn't have function i don't know how to declare >> vars. >> >> Sorry i'm a newbie :) >> >> >> >> -- >> View this message in context: http://www.nabble.com/-OSC--Bind- >> custom-vars-to-Ugen-parameters-with-osc-tp18342114p18343822.html >> Sent from the Supercollider - User mailing list archive at >> Nabble.com. >> >> >> >> _______________________________________________ >> sc-users mailing list >> >> info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de: >> 8888/MusicTechnology/880 >> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ >> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ > > > _______________________________________________ > sc-users mailing list > > info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/ > MusicTechnology/880 > archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ > search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscVery very helpful. So this is. I've to try and try, my questions are not finished :) . I'm working on the Pause Ugen by now,soon i'll post some code. thanks |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscI suppose that on new Synth i can use you Synth.set or setn messages, right? So i can message the controlled var and set it. The diffcult part i think is the getChannel on the Control. Is hard to understand why a channel retrieving a var... |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscAm 09.07.2008 um 20:46 schrieb kapitan: > I suppose that on new Synth i can use > you Synth.set or setn messages, right? > > So i can message the controlled var > and set it. yes. > > The diffcult part i think is the getChannel > on the Control. Is hard to understand > why a channel retrieving a var... this is because JCollider is much closer in this case to how the actual Synth looks like. SuperCollider is much more abstract and as a result much more ergonomic in this case, since they did the trick of re-interpreting the role of a Function. You know, { .... } is a function in SuperCollider, so the trick is instead of requiring explict Control.ir, Control.kr, LagControl.kr, and TrigControl.kr UGens, to use the reflexion features of the language to create those UGens invisibly from the arguments passed to the function. So two things: first you are not dealing with variables in a UGen graph function in supercollider, but with arguments to that function. The graph builder in SynthDef interprets those arguments and evaluates (calls) the function with Control UGens passed in. So they appear as local variables or arguments, but in fact under the hood is a Control UGen. That UGen for efficiency is implemented in a multichannel fashion, so all the control rate controls are output from one single Control.kr ugen (they represent that UGen's output channels, hence the need to call getChannel in JCollider which accesses those channels), and one single Control.ir for scalar rate controls, etc. Of course, one could have thought up a more elegant way for JCollider, but i just stick to that simple solution of requiring an explicit UGen. Also because JCollider is more targeted to application building and not really live coding, so the bits of extra effort are usually not that problematic. ciao, -sciss- _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscMy first right SynthDef? Control tk = TrigControl.kr(new String[] {"t_buf"}, new float[] {-1.0f}); Control ck = Control.kr(new String[] {"i_rate","i_start", "i_loop"}, new float[] {1.0f, 0.0f, 0.0f}); mybuffer = Buffer.cueSoundFile(ScApp.getApplication().getServer(),wav.getAbsolutePath(),0,2); //PlayBuf.ar(numChannels,bufnum,rate,trigger,startPos,loop) GraphElem g = UGen.ar ("PlayBuf",2, UGen.ir(mybuffer.getBufNum()),ck.getChannel("i_rate"), tk.getChannel("t_buf"),ck.getChannel("i_start"),ck.getChannel("i_loop")); SynthDef def = new SynthDef( "Play-Buffer", UGen.ar( "Out", UGen.ir( 0 ), g)); Synth synth = Synth.basicNew("Play-Buffer", ScApp.getApplication().getServer(),13000 ); ScApp.getApplication().getNodeWatcher().register(synth); def.send( ScApp.getApplication().getServer(),synth.newMsg(ScApp.getApplication().getServer().asTarget())); By now i set args with sclang and a message bundle, and it works...but ouch what a pain to the eyes. |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscWith cueSoundFile works and with read don't. |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with osc
But i cannot really find a get method on node nor a getMsg...how can i retrieve the value of a Control? With a getRate on the Control object? |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscahhh, it's true those methods were missing.
i added them, so please check out SVN revision 11. i have had no time to test them, so please report back if there are any issues: Synth get getn getMsg getnMsg get and getn are implemented in a quasi-synchronous way as they are not asynchronous server commands and hence should only take s.latency * 2 time. so instead of passing in a doneAction, these methods return the queried values directly. otherwise you would need to set up an OSCResponderNode and send out the getMsg or getnMsg yourself. ciao, -sciss- Am 12.07.2008 um 18:16 schrieb kapitan: > > > > Sciss wrote: >> >> >> Am 09.07.2008 um 20:46 schrieb kapitan: >>> I suppose that on new Synth i can use >>> you Synth.set or setn messages, right? >>> >>> So i can message the controlled var >>> and set it. >> >> yes. >> >>> >>> The diffcult part i think is the getChannel >>> on the Control. Is hard to understand >>> why a channel retrieving a var... >> [CUT] >> > > > But i cannot really find a get method on node > nor a getMsg...how can i retrieve the value > of a Control? > > With a getRate on the Control object? > -- > View this message in context: http://www.nabble.com/-OSC--Bind- > custom-vars-to-Ugen-parameters-with-osc-tp18342114p18421171.html > Sent from the Supercollider - User mailing list archive at Nabble.com. > > > _______________________________________________ > sc-users mailing list > > info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/ > MusicTechnology/880 > archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ > search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscOk! I'll test... But i've missed the svn :) |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscOk, i'm sorry...found! |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscProblems here... i've wrote you a mail. The first is a symbol (NodeTreePanel) is not found. The second that ugendefs.xml is bad formed i think... |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with oscSo, my today tests have as results that direct Synth.get and getn methods retrieves Control values only. If you want to retrieve a TrigControl value, you have to set up an OSCResponder Node. That is: OSCResponderNode rn = new OSCResponderNode(ScApp.getApplication().getServer(), "/n_set", new OSCListener() { public void messageReceived(OSCMessage msg, SocketAddress sender, long time) { //garbage } }); if (!rn.isListening()) rn.add(); rn.removeWhenDone(); ScApp.getApplication().getServer().sendMsg(this.execsynth.getMsg("t_pause")); //other garbage Here t_pause is a TrigControl for the PauseSelf Ugen. I really have not understand the difference between Control and TrigControl, i have to inspect the docs :-D . Bye. |
|
|
Re: [OSC] Bind custom vars to Ugen parameters with osc
I was wrong, the TrigControl are not taken with the get methods the n-set return me only 0.0f values. |
| Free Forum Powered by Nabble | Forum Help |