|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
OSC tutorial?new to supercollider -
I'm about halfway through the music examples with supercollider, and as I'm on unix, I don't have the option of making guis with sc itself. I'm working with the Net::OpenSoundControl module in Perl. I'm trying to connect to the SC Server and send messages, but I'm not getting any confirmation from either end. 1) Does the scserver print to the std out when it has recieved a connection request? 2) Does it barf and tell you there's an error when you send a malformed request? 3) What is the proper format to send messages in? Looking through the mail logs her and looking through the tutorials on sourceforge didn't really seem to give a clear picture as to what was going on. Does anyone have any suggestions or thoughts as to how I can get started and make sure I'm getting the proper feedback from the server? thanks! John |
|
|
Re: OSC tutorial?On Oct 14, 2007, at 7:46 PM, mr.proxxxy wrote:
Actually, you do. http://www.sciss.de/swingOSC/ 1) Does the scserver print to the std out when it has recieved a connection request? Not to my knowledge, but you can send it some message that will cause an error (like ['/n_free', 900]) and it should print "n_free node not found." 2) Does it barf and tell you there's an error when you send a malformed request? Not really... but any errors that happen as it's trying to process the malformed command will be reported. 3) What is the proper format to send messages in? See "Binary format of messages" in the ServerArchitecture help file. hjh : H. James Harkins : http://www.dewdrop-world.net .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman _______________________________________________ sc-users mailing list sc-users@... http://www.create.ucsb.edu/mailman/listinfo/sc-users |
|
|
Re: OSC tutorial?Hi John,
> 1) Does the scserver print to the std out when it has recieved a connection > request? I don't think so. The client (SCLang) doesn't "connect" directly to the server (scsynth). It writes to the socket where scsynth listens. > 2) Does it barf and tell you there's an error when you send a malformed > request? If you start scsynth yourself from the terminal, yes. > 3) What is the proper format to send messages in? I'm not sure what format Perl's Net::OpenSoundControl module wants. You can download and install sendOSC (and dumpOSC) from CNMAT: http://www.cnmat.berkeley.edu/OpenSoundControl/ and run the following from the terminal: %cd path/to/scsynth %./scsynth -u 57110 in a separate terminal: %sendOSC -h localhost 57110 /dumpOSC,1 %sendOSC -h localhost 57110 /g_new,1000 %sendOSC -h localhost 57110 /n_free,1000 %sendOSC -h localhost 57110 /n_free,1000 %sendOSC -h localhost 57110 /dumpOSC,0 %sendOSC -h localhost 57110 /quit and review the results in the first window. N.B. the use of commas for sendOSC is different that in SuperCollider (which uses space to separate the elements of and OSC message). Again, I'm not sure about the format for Perl's library. In SCLang, see the documentation for Server Command Reference for more details about supported commands in SC. -Brian > ----- Original Message ----- > From: "mr.proxxxy" <mr.proxxxy@...> > To: sc-users@... > Subject: [sc-users] OSC tutorial? > Date: Sun, 14 Oct 2007 16:46:00 -0700 (PDT) > > > > new to supercollider - > > I'm about halfway through the music examples with supercollider, and as I'm > on unix, I don't have the option of making guis with sc itself. > > I'm working with the Net::OpenSoundControl module in Perl. > I'm trying to connect to the SC Server and send messages, but I'm not > getting any confirmation from either end. > > 1) Does the scserver print to the std out when it has recieved a connection > request? > 2) Does it barf and tell you there's an error when you send a malformed > request? > 3) What is the proper format to send messages in? > > Looking through the mail logs her and looking through the tutorials on > sourceforge didn't really seem to give a clear picture as to what was going > on. Does anyone have any suggestions or thoughts as to how I can get started > and make sure I'm getting the proper feedback from the server? > > thanks! > John > -- > View this message in context: > http://www.nabble.com/OSC-tutorial--tf4623790.html#a13204757 > Sent from the Supercollider - User mailing list archive at Nabble.com. > > _______________________________________________ > sc-users mailing list > sc-users@... > http://www.create.ucsb.edu/mailman/listinfo/sc-users > _______________________________________________ sc-users mailing list sc-users@... http://www.create.ucsb.edu/mailman/listinfo/sc-users |
|
|
Re: OSC tutorial?Thanks for your help here -
I picked this up after giving up 5 months ago. I've managed to get supercollider to listen to osc messages coming in, but now I'm at a point where it's only complaining if I'm giving it something it doesn't know and silently accepting (but not appearing to do anything) when I'm giving it something it does. Example: Supercollider code: Server.default = s = Server.local.boot ( o = OSCresponder(s.addr, '/anything', {arg time, responder, msg; "anything".postln; }).add;) a = NetAddr("127.0.0.1", 7331); a.sendMsg("/anything") I evaluate the sendMsg line and I get in the server window what I would expect - namely: a NetAddr(127.0.0.1, 7331) I interpret that as saying - I recieved a message from port 7331 on host 127.0.0.1. Cool. ----------- Perl Code: Here's where it gets dicey. I'm trying to write a perl script to attach to the supercollider server so I can do neat things with text, datastructures and system calls that I can't do with sc alone. SO! #!/usr/bin/perl use Net::OpenSoundControl; use Net::OpenSoundControl::Client; my $client = Net::OpenSoundControl::Client->new( Host => "127.0.0.1", Port => 57110) or die "Could not start client: $@\n"; my $port = $client->port(); my $host = $client->host(); print "I should be using port $port on host $host\n"; print "Sending test message ...\n"; $client->send(['/anything']); $client->send(['/status']); $client->send(['/statoos]'); --------- and on the supercollider log window I see: FAILURE /anything Command not found FAILURE /statoos Command not found Whaaaaaaat? 1) /anything is defined, but I'm recieving an error message saying it's undefined. 2) /status is definitely defined, but i'm recieving neither an OK nor a Reject. Huh? 3) /statoos is not defined, so I'm recieving an error message saying it's undefined, as expected. I know that "/anything" is defined locally ... do I have to do something to make this location able to be called from an outside process ? Am I missing some crucial bit of information? What is going on? I'm kind of tearing my hair out, and I don't know where to look for documentation ...
|
|
|
Re: OSC tutorial?Hiho,
On Tuesday 04 March 2008 22:57:37 mr.proxxxy wrote: > Whaaaaaaat? > > 1) /anything is defined, but I'm recieving an error message saying it's > undefined. > 2) /status is definitely defined, but i'm recieving neither an OK nor a > Reject. Huh? > 3) /statoos is not defined, so I'm recieving an error message saying it's > undefined, as expected. > > I know that "/anything" is defined locally ... do I have to do something to > make this location able to be called from an outside process ? > > Am I missing some crucial bit of information? You have defined the OSCresponders in sclang, which listens normally at port 57120 (check with NetAddr.langPort for the actual port). However you send the messages from perl to scsynth, which listens at port 57110, and understands only the messages defined in the Server Command Reference. It seems what you want to do, is sending messages to sclang, which then converts them to usable messages for scsynth, so you should change the port to which you are sending from perl. sincerely, Marije _______________________________________________ sc-users mailing list sc-users@... http://lists.create.ucsb.edu/mailman/listinfo/sc-users |
|
|
Re: OSC tutorial?You are a saint!
I now have my two processes communicating, so now i'm up to the painful part of actually getting them to make some sort of sound. :) Thanks very much.
|
|
|
Re: OSC tutorial?OK!
I have my processes generating sound, and in the interest of keeping this thread going, i have a few more questions. Too long ; Didn't read version: It's simple enough to parse arguments in line - e.g. check to see if argument one is valid, argument two, etc. and act appropriately. However, this is akin to doing a $1, $2, $3 ... $n in a shell script. Perfectly valid, but it's not terribly flexible or extensible. How can I do a "getops" type argument parsing in an OscResponder? Long version: example sc code: ( f = OSCresponder(nil, '/ding', { |t, r, msg, addr| "Entering into OscResponder f".postln; addr.postln; // posts the address and port from where the message came msg.postln; // posts the entire message - channel and variables msg[1].postln; // posts the first argument or 'nil' msg[2].postln; // posts the second argument or 'nil' msg[3].postln; // posts the third argument or 'nil' if (msg[3] != nil) { "Msg 3 is not empty!".postln; }; if (msg[3] == nil) { "Msg 3 is empty!".postln; }; }).add; ) perl script: my $client = Net::OpenSoundControl::Client->new( Host => "127.0.0.1", Port => 57120) or die "Could not start client: $@\n"; // cheers nescivi for specifying the port! :) .... (boring stuff) $client->send(["/ding","s","Hello world!","s","Hello Moon!","s","Hello Venus!"]); $client->send(["/ding","s","Hello world!","s","Hello Moon!"]); ..... (more boring stuff) exit 0; returns: a NetAddr(127.0.0.1, 33021) [ /ding, Hello world!, Hello Moon!, Hello Venus! ] Hello world! Hello Moon! Hello Venus! Msg 3 is not empty! Entering into OscResponder f a NetAddr(127.0.0.1, 33367) [ /ding, Hello world!, Hello Moon! ] Hello world! Hello Moon! nil Msg 3 is empty! This is cool! Makes me happy that SuperCollider is responding to my commands. I even managed to get it to change the pitch of a sinewave based on the messages sent from perl. Love it! So now I'm thinking to myself - I know that I want to say Hi to the World, to the moon and to sometimes Venus, so can I define an osc responder that allows me to send a message to "/hello/world" with value 1 and have it print "Hello World!" ? Of course I can, I can just define " f = OSCresponder(nil, '/hello/world' .... " but then what about /hello/moon and /hello/venus ? I would have to build a seperate osc responder for those, and that doesn't seem to make much sense! Or, maybe it does, but it would sure hurt my fingers typing that much! I would think that you could do something like 'getopts' (to use more perl parlance) to have some message like this: [ "/ding", [ "/world", "1" ], [ "/venus", "1" ]] that would go to the OscResponder /ding, then look at "/world" in ding, check the variable and print out the appropriate value. looks intially like a bit more work, but let's say we have a sinOsc that has its volume and pitch defined in the result of an osc responder - wouldn't something like ["/super_osc",["/pitch","440"],["/volume","1"] make a bit more syntatic sense than ["/superosc",440,1] ? Still looking through the documentation, for an answer, but any help would be appreciated!
|
| Free embeddable forum powered by Nabble | Forum Help |