How to get muse player to take udp port as input?


#1

I’m trying to use the feature of the player to get the data from a port and then dump it out on the screen. muse-player.py -l 5000 -D doesn’t work because the player assumes that it is TCP. I don’t know how to set it to be UDP and I can’t get my muse headband to work with a TCP port. Does anyone know how to set this in the command line?


#2

Also, from the example in the player, it looks as if muse-player.py -l osc.udp://localhost:5000 -D should work but it does not.


#3

Hi KateP,

What version of the SDK are you using, and what operating system are you using it on? Sound like Windows.

I’m running the Muse SDK 2.4.2 on a Macbook Air here, and this command works for me:

muse-player -l udp:5000 -D

#4

That opens a notepad window with what looks to be a python script (see below). Ultimately, what I need to do is get the data streaming into a statistical analysis package ®. If I could get the data stream into something like java or python I could probably ultimately call the R functions from that environment. But I’ve been beating my head against this and getting nowhere :frowning:

#!/usr/bin/python
import signal
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from input_handler import *
from output_handler import *
import Queue
import threading
import utilities
import platform

Catch Control-C interrupt and cancel

def ix_signal_handler(signum, frame):
done = True
print ""
print "Aborting."
utilities.DisplayPlayback.end()
if input_handler and args.input_osc_port:
input_handler.put_done_message()
if streaming_input_thread and args.input_osc_port:
streaming_input_thread.join()

and so on…


#5

Hi KateP,

Are you running on Windows ?
It seems that, for some reason, you have associated the “.py” extension with notepad instead of Python (installation of python automatically makes this association), but you may have been opening those python scripts with notepad and choosed to use it as default program to open .py files.

I agree with you, if osc.udp://localhost:5000 works for output, why not for input ?
I have faced the same problem in the begining, until I realized that for input the syntax is what Tom said.

muse-player.py -l udp:5000 -D should work

But you can also try this:

… python muse-player.py -l udp:5000 -D

HTH, Eduardo.


#6

It turns out is was opening python scripts with Notepad. I’m posting a very simple example of the .py file for streaming data into Python. If someone else is trying to do the same thing, I hope this saves you a little bit of Googling.

Once you can see the data coming in OK in the MuseLab, go to OSC -> Outgoing -> choose IP address and port -> Select UDP -> Add -> select data types to forward.

Run listen.py (port number in sock.bind is the same port number that you chose in MuseLab to forward data to)

listen.py

import socket
import OSC

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((‘0.0.0.0’, 5001))

while 1:
data, rest = sock.recvfrom(1024)
myobject = OSC.decodeOSC(data)
print myobject
print type(myobject)