Using grid on linux, via haskell

I want to use the monome in Ubuntu Studio, roughly.* I know there was at least one app for the monome written entirely in Python. I’d like to use that as a model.** Does anybody know which app(s) that is? Is that something that can be run without emulating Windows?

  • actually a KUbuntu distribution, but with everything from the Studio repos installed

** I want to use the monome to control SuperCollider, via Haskell – but if I can connect to the monome from Python, I assume I’ll be able to connect to it from Haskell.

1 Like

I would guess that link could get you started. Also, there is a grid studies page for SuperCollider as well. The grids and arcs are well supported in SC if you ever wanted to do everything in SC.

1 Like

at first you want to follow steps 1 and 2 from then you will have everything that’s needed to use the grid with any language supporting the OSC protocol.

Sweet! Thanks, guys!

EDIT: I might see the answer. The serialosc server listens on port 12002, and I should only communicate with that, not directly to the device. So sending a message will look something like udp.send( 12002, "/grid/led/level/set x y l" ), correct?

I want to connect to the monome using Haskell, by sending raw OSC over UDP.

I can connect to the monome using Python, via the pymonome library – but pymonome is too high-level for me to see how it’s doing that.

To connect to a device over UDP, what do you need? Just the device’s address in the filetree? Or maybe I shouldn’t send directly to the monome at all, and should instead send to the serialosc server? That’s my impression from looking at the monome OSC protocol. If that’s true, is serialosc running on a specific port? How can I know which one?

When I plug the monome in, a device called ttyUSB0 shows up in my /dev/ folder. Probably related, if I run serialosc-detector, I see the following print to the screen:


Maybe there is a UDP port number associated with the monome, too? If so, how can I find out which port number is associated with the monome?

I want to connect to the monome using Haskell, by sending raw OSC over UDP – because Haskell has no monome libraries (yet).

My first quesiton: My program should only communicate with the serialosc server, not directly with the device, correct?

My second question: Are the address “”) and the port “12002” all that should be required in order to find serialosc?

I believe my Haskell code is doing the following:

  • Creating a connection specified by that (address,port) pair.
  • Then sending the OSC message /monome/grid/led/set 1 1 15 where the first is a string and the rest are integers.

I’m seeing no effect on the monome. By contrast, the first program in the monomne Python tutorial works perfectly.

The code (all 10 lines of it) is here.

Yay Haskell!


That way it’s usable without serialosc in situations that require it.


data MonomeConnection = SerialOSC  HostName ServiceName
                      | Device FilePath

The Serial OSC protocol is described here:

And, you might not have seen, but this doc also describes the raw serial message protocol:

The format of the second document isn’t the easiest to follow, but it does contain a lot of useful info once you’ve got your head round it.

Alternatively if you’re only after end results, rather than a pure Haskell solution, the easiest option might be to wrap libmonome in Haskell.

The header file that you’d need to wrap is here:

There are also some examples in that repo. One issue is how to deal with incoming events (i.e. button presses), I’m not sure if libmonome expects you to only use it’s event loop (via callbacks), or if you can manually poll the event queue. Either way, you’ll eventually need some sort of higher level event model in your Haskell code.

Hope that’s helpful.


I might indeed use foreign function calls and let Python handle talking to serialosc. I was only worried that it might introduce latency.

Do I have the connection strategy right? That the address “” and the port “12002” all that should be required in order to find serialosc, and that the message /monome/grid/led/set 1 1 15 (where the three numbers are integers) is something that should be understood by the monome?

I’m suspicious about the message, because what if I had two monomes plugged in? They can’t both be called “monome”, so the OSC type tag string /monome/grid/led/set seems ambiguous.

libmonome is C based. So if you FFI to that there won’t be any performance overhead.

I’m afraid I have no idea regarding the OSC stuff.

You might wanna check out Rohan Drape’s OSC and SuperCollider work for haskell (hosc and hsc3 respectively):

I’d love to dig deeper into this but haven’t had the time yet to do it.

EDIT: It works!

With the help of @artfwo I was able to get monome communication working. Here is a proof of concept. It sends one message to serialosc and receives one from it as a result. I will have fleshed it out along the lines of pymonome by the end of the year.

What I wrote before that edit

I’ve got a working demo that sends and receives UDP over a specified host/port combination. But when I try to do that with the monome, it doesn’t work.

(I originally started by trying to use Rohan Drape’s work, but didn’t get it, and then Tom Murphy added a really simple demo to Vivid-OSC, so I’m using that.)

Am I correct in understanding that serialosc listens on localhost port 12002, and when you send it the OSC message “/sys/info host port” it will send information about connected devices to the port specified in that OSC message? Should the host be encoded as a string, and the port as an integer?

And does serialosc use UDP?

1 Like