I am trying to write a script that sends OSC UDP packets to the local system. This did not work. When I try something simple like this that is based on the example in the WIKI I would expect a reboot, but nothing is happening:
import liblo
liblo.send((‘127.0.0.1’, 1370), “/cuia”, (‘s’, ‘reboot’))
I tried using ‘localhost’ instead of the IP, did not work. And when I tried to capture the UDP packets with tcpdump -i lo udp, nothing got captured. I checked with netstat and port 1370 is open and listens on all interfaces.
I did even try to use mididings and it’s built-in SendOSC function that is part of the extras. Same problem, no network output.
I think the parameters may be in the wrong order. Path should be last.
Examples:
liblo.send('osc.udp://localhost:1370', '/CUIA', 'reboot')
addr=liblo.Address('osc.udp://localhost:1370')
msg=liblo.Message('/CUIA', 'reboot')
liblo.send(addr, msg)
liblo.send(('localhost', 1370), '/CUIA', 'reboot')
You don’t have to provide the OSC data type for many Python data types, e.g. string is automatically detected as in the above examples.
All of these sent UDP messages to the localhost. I am working on something else at the moment so my dev Zynthian is stopped hence I did not test the actual CUIA actions but have done so in the past.
Thanks @riban, I am getting packets now. Assembling the message via liblo.Address and liblo.Message worked. However, although the packets are proper OSC packets (checked with Wireshark), Zynthian is not reacting despite port 1370 being open.
Do I have to enable or disable anything in order to allow CUIA remote control over OSC ?
I am using the “dummy” wiring and an external touchscreen connected to the Pi.
Just checked the Zynthian debug log. I am getting these tracebacks:
Apr 23 10:11:02 zynthian startx[4497]: INFO:zynthian_gui.osc_cb_all: OSC MESSAGE ‘/CUIA’ from ‘osc.udp://127.0.0.1:42220/’
Apr 23 10:11:02 zynthian startx[4497]: Traceback (most recent call last):
Apr 23 10:11:02 zynthian startx[4497]: File “src/liblo.pyx”, line 56, in liblo._weakref_method.call
Apr 23 10:11:02 zynthian startx[4497]: File “./zynthian_gui.py”, line 304, in osc_cb_all
Apr 23 10:11:02 zynthian startx[4497]: self.callable_ui_action(parts[2].upper(), args)
Apr 23 10:11:02 zynthian startx[4497]: IndexError: list index out of range
Apr 23 10:11:02 zynthian startx[4497]: Exception ignored in: ‘liblo._msg_callback’
Apr 23 10:11:02 zynthian startx[4497]: Traceback (most recent call last):
Apr 23 10:11:02 zynthian startx[4497]: File “src/liblo.pyx”, line 56, in liblo._weakref_method.call
Apr 23 10:11:02 zynthian startx[4497]: File “./zynthian_gui.py”, line 304, in osc_cb_all
Apr 23 10:11:02 zynthian startx[4497]: self.callable_ui_action(parts[2].upper(), args)
Apr 23 10:11:02 zynthian startx[4497]: IndexError: list index out of range
Here is the Wireshark capture of the packets I am sending to Zynthian:
capture.dat (30.7 KB)
I just filed a bug report: OSC CUIA implementation not working · Issue #441 · zynthian/zynthian-issue-tracking · GitHub
Hi @catherder !
AFAIK, the OSC CUIA is working OK. It’s actively used to communicate webconf and update system with the UI, so if it were broken, everybody would note it.
Take a look to the code used by webconf:
Regards,
So you need to include the action in the path, not provide it as a parameter, e.g. /cuia/reboot
.
Excellent - Problems solved ! So the conclusion is that this works:
addr=liblo.Address(‘osc.udp://localhost:1370’)
msg=liblo.Message(’/CUIA/REBOOT’)
liblo.send(addr, msg)
I am going to close the bug report now. Maybe it would be good to update the WIKI to reflect this, specially as the current example is not working.
I do have one more question though:
When a specific layer is loaded, the Zynthian encoders allow to change the parameters shown on the touchscreen. This does not happen in my case. Do I need to use MIDI learn for every layer or is there a kind of universal setting that allows to control the currently visible layer parameters via CUIA ?