electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Rob Adventures in Sound
Please visit the chat
 Forum index » DIY Hardware and Software » Supercollider
OSC - FAILURE /insertCommandNameHere Command not found
Post new topic   Reply to topic Moderators: v-un-v
Page 1 of 1 [10 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Ataxian



Joined: Mar 03, 2009
Posts: 11
Location: UK

PostPosted: Tue Mar 03, 2009 8:27 am    Post subject: OSC - FAILURE /insertCommandNameHere Command not found Reply with quote  Mark this post and the followings unread

Hi guys, good to see a decent dedicated SuperCollider board on the net!

I have a question about OSC as it has been a while since I last used SuperCollider.

The following code:

Code:

   d = OSCresponder
   (
      addr: s.addr,                        // Default Server addrress
      cmdName: '/a',                     // OSC Message/Command Name
      action:
      {
         arg time, responder, msg, addr, rate;
         //[time, responder, msg, addr].postln;   // Display OSC message in Post Window
         msg[1].postln;
         rate = msg[1];               // msg[1] = /*.* where *.* is the OSC message
         s.sendMsg("/n_set", 1000, \buffer1Rate, rate);   // Send an OSC message to the server
      }
   ).add;



will not let me pass messages to it from Max/MSP 5 as it will tell me that the OSC command (/command) has not been found.

Can anyone explain why this is happening please?
Back to top
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20280
Location: The Netherlands, Enschede
Audio files: 143
G2 patch files: 318

PostPosted: Tue Mar 03, 2009 9:49 am    Post subject: Reply with quote  Mark this post and the followings unread

welcome Ataxian,

next time when you have a double post you can simply delete it yourself, that is as long as there was no reply to it.

Sorry to not be able to help with your question.

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Ataxian



Joined: Mar 03, 2009
Posts: 11
Location: UK

PostPosted: Tue Mar 03, 2009 10:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Thank you for the warm welcome Blue.
Back to top
View user's profile Send private message
Ataxian



Joined: Mar 03, 2009
Posts: 11
Location: UK

PostPosted: Tue Mar 03, 2009 2:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

Problem solved but it only raises another issue, which I would be grateful for someone more knowledgeable than me to explain.

If I change the listening address with the following line:

n = NetAddr.new("127.0.0.1", 7771); // create the NetAddr

then querying the listening address with:

NetAddr.langPort; // retrieve the current port SC is listening to

will still return Port 57120?!

Why is this?

EDIT: Forget that too!

Turns out the NetAddr must only be changed after the server has been booted.

Is there a way to only do commands automatically after the server has been booted?
Back to top
View user's profile Send private message
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Tue Mar 03, 2009 8:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

The SC client (which handles OSCresponder, OSCresponderNode etc.) always receives OSC on port 57120. That's hardcoded. If you have two instances of sclang running, one will use 57120 and I think the next will roll up to 57121.

Your Max patch must send OSC to port 57120. That's not changeable (sorry).

The server's default port is 57110. You can change the port before booting the server using s.addr.port = (port number). The port number here gets included in the scsynth command, and that is the port the server tries to open.

scsynth -u 57110 -b 1026 -R 0

As far as I know, there isn't a way to change the server's listening port without stopping and restarting the server.

Dunno if this has confused more than clarified. Feel free to ask other questions.

Oh, executing something automatically after boot:

s.waitForBoot({
... stuff in here ...
});

James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Ataxian



Joined: Mar 03, 2009
Posts: 11
Location: UK

PostPosted: Wed Mar 04, 2009 8:24 am    Post subject: Reply with quote  Mark this post and the followings unread

Thank you very much James.

There is one other question I have about OSC, and one general question if I may.

Why can I update the "buffer1Rate" parameter with OSC messages:

Code:


      // define a sample player that will loop over a soundfile
      SynthDef("Buffer1",
      {
         arg outBus = 0, bufnum = 0, buffer1Rate = 1, rateScale = 1;
         Out.ar
         (
            outBus,
            PlayBuf.ar
            (
               numChannels: 1,
               bufnum: bufnum,
               //rate: BufRateScale.kr(bufnum) * rateScale + LFNoise1.kr(2.reciprocal, 0.05),
               rate: buffer1Rate,
               //trigger: ,
               //startPos: ,
               loop: 1            // play the soundfile over and over without stopping
               //doneAction:
            )
         )
      }).load(s);




Yet I can't change the "delayTime" parameter here with OSC messages?!

Code:


      SynthDef("echo1",                         // Synth Definition and NAME
      {
         // Local variables on first line
         var inBus = 0, outBus = 0, signal, echo, delayTime = 3;
         signal = In.ar(inBus, 2);    // Input Signal (inBus)         echo =    CombC.ar   // Define FX (echo)                  (
                  in: signal,
                  maxdelaytime: 10,
                  delaytime: delayTime
               );    
         Out.ar(outBus, echo);    // Output Signal         }).load(s);




The OSCresponderNodes are as follows:


Code:


   OSCresponderNode
   (
      addr: nil,   // n                     // Default Server addrress
      cmdName: "/OSC_buffer1Rate",            // OSC Message/Command Name
      action:
      {
         arg time, responder, msg, addr;
         //[time, responder, msg, addr].postln;   // Display OSC message in Post Window
         buffer1Rate = msg[1];               // msg[1] = /*.* where *.* is OSC message
         // Send OSC message to the server
         s.sendMsg("/n_set", 1000, "buffer1Rate", buffer1Rate);   
      }
   ).add;
   OSCresponderNode
   (
      addr: nil,   // n                     // Default Server addrress
      cmdName: "/OSC_echo1DelayTime",            // OSC Message/Command Name
      action:
      {
         arg time, responder, msg, addr;
         echo1DelayTime = msg[1];            
         s.sendMsg("/n_set", 1001, "delayTime", echo1DelayTime);         
      }
   ).add;



The second question:

Can you recommend any software (for Mac) that automatically helps with the formatting of SuperCollider code, much like Visual Studio for C++ etc.
Back to top
View user's profile Send private message
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Wed Mar 04, 2009 8:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

There's nothing inherent in the language to prevent setting the control in the synth, so I have to suppose it's one of a couple of things.

Have you checked to make sure the incoming OSC message is properly received? You can check a couple of ways: by adding "msg.postln;" in your OSCresponderNode, or doing this to see all incoming OSC. (It's a good idea to filter out /status.reply messages from the server, since there will be a lot of them.)

Code:
thisProcess.recvOSCfunc = { |time, addr, msg|
   if(msg[0] != '/status.reply') { msg.postln };
};

// to turn off dumping:
thisProcess.recvOSCfunc = nil;


Maybe the message never reaches SC, or maybe the OSCresponderNode doesn't get triggered.

Also try tracing node 1001 to see what the actual control inputs are.

Code:
s.sendMsg(\n_trace, 1001);


Quote:
The second question:

Can you recommend any software (for Mac) that automatically helps with the formatting of SuperCollider code, much like Visual Studio for C++ etc.


Somebody did a TextMate bundle (Google can probably help you). I haven't used it but I hear it's more powerful than the built-in SC editor.

James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Ataxian



Joined: Mar 03, 2009
Posts: 11
Location: UK

PostPosted: Thu Mar 05, 2009 8:45 am    Post subject: Reply with quote  Mark this post and the followings unread

For some reason the following line does not prevent status replies (oh well, it's not too important)

Code:


if(msg[0] != '/status.reply') { msg.postln };



I got it working by setting the fx to a group called ~fxgroup and using ~fxgroup.nodeID as the node.

There's one final problem that is definitely ignorable but still bothers me.

Setting the addr: to anything other than nil will not allow for messages to be received.

So I can't go ahead and set the addr: to NetAddr.localAddr; or addr: s.addr for example. (Where s is the local server)... how strange.

As for the changing of the delay time in the Comb filter:

Changing the values result in weird artifacts and other horrible sounds, is there a way to alleviate this problem (such a interpolating between input values)?

Thanks.
Back to top
View user's profile Send private message
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Thu Mar 05, 2009 8:41 pm    Post subject: Reply with quote  Mark this post and the followings unread

The reason why NetAddr.localAddr does not work in an OSC responder is that this is the address and port that supercollider is listening to. The OSC responder (if the port is given) needs to have the port FROM which the messages are coming. If Max is sending FROM port 7771, then the address given to the OSC responders should be NetAddr("localhost", 7771).

Then Max needs to send TO port 57120. But understand -- the fact that Max is sending TO this port does not mean that the OSC responder should have this port in its address.

I know this is confusing... I'm not sure how else I can explain it to make it clear.

Think of it this way -- the address in the OSC responder is a filter to prevent that responder from taking action based on the wrong source. Supercollider's listening port (57120) is useless as a filter because every message coming into the supercollider language is received at this port! It is meaningful only if it refers to the port that the other application is using to send messages FROM.

CombC -- right now you're sending instantaneous changes in the delay time, which will give you nasty clicks. Try wrapping the delay time in a Lag, to smooth the transition.

// before CombC
delayTime = Lag.kr(delayTime, 0.1);

James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Ataxian



Joined: Mar 03, 2009
Posts: 11
Location: UK

PostPosted: Fri Mar 06, 2009 6:37 am    Post subject: Reply with quote  Mark this post and the followings unread

Excellent, thank you.

I will leave the addr: as nil for now, seeing as I can't figure out what specific addr: will work for my settings and from what you said.

I've just been looking at your SuperCollider pattern tutorials; v. nice!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: v-un-v
Page 1 of 1 [10 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Supercollider
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
AmbiphonicDSP

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use