Skip to content

problem with server and client #129

@mattfack

Description

@mattfack

I am a fairly experienced python user, but I have no experience with OSC protocol.

I am helping a friend in building a python code that should do the following:

  1. receive a message from MAX via OSC
  2. elaborate the message in python
  3. send the elaborated message to SuperCollider via OSC

What is not clear to me is what concerns points 1 and 3

PART 0
import methods

from pythonosc import dispatcher
from pythonosc import osc_server
from pythonosc import udp_client

PART 1
setup a simple server for point 1, since I am only receiving one string at a time from MAX:

def listen2Max(ip,port):
    '''
    set up server
    '''
    # dispatcher to receive message
    dispatcher = dispatcher.Dispatcher()
    dispatcher.map("/filter", print)
    # server to listen
    server = osc_server.ThreadingOSCUDPServer((ip,port), dispatcher)
    print("Serving on {}".format(server.server_address))
    server.serve_forever()

but i do not know what to return in this function, also I do not get the use of "/filter" in the map. Is it something that must be specified in MAX?

PART 2

elaborate message with python

some python code that returns mymove

PART 3

set up a simple client to communicate the string var mymove to SuperCollider

def talk2SC(ip,port,mymove):
    '''
    set up client
    '''
    client = udp_client.SimpleUDPClient(ip,port)
    client.send_message("/filter", mymove)

Should it work like that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions