< Back to IRCAM Forum

Simple example of oscrecv

Hi,

I have been spending some time trying to have the “oscrecv and whenever” mechanism to work.
Probably a simple detail that escapes me.
Here is the minimalistic script I try to run:
-------------- test.asco.txt -----------

  
whenever ( $addrclient == $addrclient){  
   print "Address client set to: " $addrclient  
}  
oscrecv oscin_addr 55667 "/init/addr" $addrclient  

A bare patch to test this score:

  • has a print label [receive print]-[print]
  • sends a message to load the score
  • sends a message to start the follower

I use the simple python script to test:

  
import argparse  
import time  

from pythonosc import osc_message_builder  
from pythonosc import udp_client  

if __name__ == "__main__":  
    parser = argparse.ArgumentParser()  
    parser.add_argument("--ip", default="127.0.0.1",  
                        help="The ip of the OSC server")  
    parser.add_argument("--port", type=int, default=55667,  
                        help="The port the OSC server is listening on")  
    args = parser.parse_args()  

      
    client = udp_client.SimpleUDPClient(args.ip, args.port)  
    for x in range(10):  
        oscroute = "/init/addr"  
        print("Sending: ", oscroute + " 127.0.0."+x.__str__())  
        client.send_message(oscroute, "127.0.0."+x.__str__())  
        time.sleep(1)

with no avail.

When I test with the PD message:
[setvar $addrclient 128.0.0.1<
I get the correct display in the console:
Address client set to: 128.0.0.1

Any insight would be welcome.

Best

Trad