« Return to Thread: OSC tutorial?

Re: OSC tutorial?

by mr.proxxxy :: Rate this Message:

Reply to Author | View in Thread

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



Brian Willkie wrote:
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@gmail.com>
> To: sc-users@create.ucsb.edu
> 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@create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-users

>


_______________________________________________
sc-users mailing list
sc-users@create.ucsb.edu
http://www.create.ucsb.edu/mailman/listinfo/sc-users

 « Return to Thread: OSC tutorial?