OSC out of Tidal, ghc network error

I feel like I'm really close to getting Tidal to send OSC to SuperDirt AND a target on my local network (an iPad running TouchOSC)

I followed the tutorial here and looked through a number of threads here to get going.

I have an additional target set up and it's working fine - running oscdrump on the same computer Tidal is running on shows me I'm getting messages. But sending only works if the value of oAddress is set to "," "" and "".

But if I set the oAddress to anything else, like the IP of my iPad ( I get this error when evaluating Tidal code in Emacs:

ghc: Network.Socket.sendBufTo: invalid argument (Invalid argument) 

I hope that makes some sense!
I figure I'm either 1) grossly misunderstanding this, 2) missing something here

Has anybody successfully sent OSC from Tidal to another computer on the local network?

Ah yes there is a complication where tidal sends out OSC messages on the same address that it receives them. The easiest fix is to do set cCtrlAddr to, so it can receive and send OSC on any network. So when you start tidal pass in a config like:

(defaultConfig {cCtrlAddr = ""})

I've made an issue about it here: Sending to another computer needs a cCtrlAddr setting · Issue #926 · tidalcycles/Tidal · GitHub

ah thanks Alex! awesome, I'll give that a try

I tried to implement this to send OSC to a remote RPi but I keep getting errors. I added this to my BootTidal.hs

pivizTarget :: Target
pivizTarget = Target {oName = "piviz",
                       oAddress = "",
                       oPort = 8007,
                       oBusPort = Nothing,
                       oLatency = 0.02,
                       oWindow = Nothing,
                       oSchedule = Live,
                       oHandshake = False
pivizShape :: OSC
pivizShape = OSC "/piviz" $ ArgList [("vizscene", required),
                                       ("vizcommand", sDefault "next"),
                                       ("vizsize", fDefault 32),
                                       ("vizspeed", fDefault 150)

let vizscene = pS "vizscene"
    vizcommand = pS "vizcommand"
    vizsize = pF "vizsize"
    vizspeed = pF "vizspeed"

  tidal <- startStream defaultConfig [
                                      (espeakTarget, [espeakShape]),
                                      (pivizTarget, [pivizShape]),
                                      (superdirtTarget {oLatency = 0.05, oAddress = "", oPort = 57120}, [superdirtShape])

-- tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20})
tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20, cCtrlAddr = ""})

This will boot the server but still not let me connect to the RPi I want to send OSC data to.
it outputs:

Listening for external controls on
Connected to SuperDirt.
[TidalCycles version 1.9.2]
Installed in /home/kaos/.cabal/share/x86_64-linux-ghc-9.0.2/tidal-1.9.2
Listening for external controls on
That port isn't available, perhaps another Tidal instance is already listening on that port?
Can't handshake with SuperCollider without control port.

I tried fitting the cCtrlAddr in the tidal <- startStream defaultConfig part but nomatter what I tried I would not boot... (syntax problems)

The espeak part works by the way, I started there and tried to adapt it to remote OSC, but no go...,

Try to comment the last line as well, as here you are starting two tidalcycles

1 Like

Yes startStream should replace startTidal here.

The first instance (from startStream) starts saying Listening for external controls on This is not only the port it's listening to, but also the one it's sending OSC from. So it's trying to send OSC from the localhost network to the external network, which will fail. So yep you need to add that cCtrlAddr part to the startStream call.

Try solving the syntax error with parenthesis, link:
startStream (defaultConfig {cCtrlAddr = ""}) [

that indeed solves it. I had no Idea how to expand the defaultConfig parameter.
I copied in the cVerbose = True, cFrameTimespan = 1/20 attributes as well, as I did not know what would happen if they are left out.
final startStream call looks like this:

  tidal <- startStream (defaultConfig {cVerbose = True, cFrameTimespan = 1/20, cCtrlAddr = ""}) [
                                      (espeakTarget, [espeakShape]),
                                      (pivizTarget, [pivizShape]),
                                      (superdirtTarget {oLatency = 0.05, oAddress = "", oPort = 57120}, [superdirtShape])

Sending data also works now!

Great! I've made a note to update the default BootTidal.hs so it uses the newer/more flexible startStream function rather than startTidal, and generally make it easier to edit..

I think cVerbose = True, cFrameTimespan = 1/20 are the default value but of course it does no harm to define them.