Using libmonome, can't get the examples to work with OSC, events are not consistent using tty

I’ve been spending some time with libmonome in these days, but I can’t get even the simple.c example to work with my monome using OSC… it fails silently. Could you please guide me through this? There’s a second issue below, could be related.

/serialosc/list si localhost 12435
to serialosc, I get
/serialosc/device ssi “m40h0351” “monome 40h” 13129

I use that port in in examples/simple.c to define

MONOME_DEVICE "osc.udp://"

Then call

monome_open(MONOME_DEVICE, "8000")

And it just doesn’t work. Suspicious because, even if I put a different port after it still does the same and monome_open doesn’t return any error.
Also, Could you tell me what’s 8000 in this method call?

Anyway, instead if I use


everything works. or, more or less, read on.

The other problem I have regards lost events when using monome_event_loop:

monome_register_handler(monome, MONOME_BUTTON_DOWN, btn_down, NULL);
monome_register_handler(monome, MONOME_BUTTON_UP, btn_up, NULL);

Shows clearly that sometimes I don’t get the notified about a button up or a button down event, because they don’t match.
With monome_sum, instead, everything works . Do you have any hints about what’s going on?

you need to turn off serialosc if you’re trying to make something that uses libmonome.

serialosc uses libmonome, so it will be launching processes that capture the grid devices’ serial ports. if you try to capture the port with another app (written with libmonome) you will fail.

1 Like

Thanks, ok I killed serialoscd and removed the LaunchAgent, just to be sure.
Now, what shall I write in
define MONOME_DEVICE “osc.udp://”
What shall I put in
monome_open(MONOME_DEVICE, “8000”)
and what is the meaning of these ports? thank you!

i think you can define those as you’d like? for external OSC control. @wrl

but i haven’t checked the code or played with libmonome alone for awhile. have you simply tried running it?

I tried, the handlers aren’t triggered… there’s something on port 8000 because I can’t open oscdump 8000. For the rest, all silent.
Do you know something about my second question above? missed events. I can get away with just tty but I am trying to finish an application and that’s a show stopper

if you have serialosc running, use an OSC URL in monome_open(). if you don’t, use the path to a raw serial device. libmonome lets you use the same API to talk to either.

that second parameter in monome_open() is the port on which it will listen for events from serialosc. if you’re using a recent git checkout (and you should make sure you are), libmonome should automatically inform the running serialosc instance of its listen port.

Strange, it didn’t work, really, I’ve built libmonome from github yesterday… Using the OSC URL after querying serialosc and using that port.
MONOME_DEVICE “osc.udp://”
MONOME_DEVICE “osc.udp://”
(I don’t know what that /monome is, the application I guess)
the handlers aren’t called.

About my second question, the best I’ve come up with is
while(1) {
That doesn’t lose events like it happens if I use monome_event_loop. Could you comment about this?

have you verified that serialosc is not running when you use the tty path directly?

Yes, and it actually works either if serialosc is running or not! weird

I’ll make sure my system is up-to-date tonight, but I’m using something like this in my code…

char monome_device_addr[128];


if( !(monome = monome_open(monome_device_addr, "8000")) ){
    fprintf(stderr, "ERROR failed to open monome device. Aborting!");
    return -1;

Then I spawn another thread with the monome_event_loop() while the main execution thread waits on keyboard input in case I want to quit the application. The monome device is a global.

Do I need to make any changes to the monome_open() call in examples/test.c if I want the example to work with serialosc currently running?

You might have to modify the constants in each example to match the port that your monome is on.

Change the 8080 below to the port serialosc mentions when you connect your device:
#define DEFAULT_MONOME_DEVICE "osc.udp://"

$ ./waf

Since serialosc is a daemon, it does not “mention” anything. I can’t even find anything in the log console.

I can use serialosc bpatcher to learn about a send port and a receive port, but using those port numbers and recompiling does not cause the monome to light up when running examples/test

I have written plenty of daemons which “mention” things or print to standard error, just like serialoscd does when you connect a monome device.

After I edit the ports, the tests build and work for me. Seems this might be a Macintosh-related bug.