Using OSC to control TidalCycles

I'm trying to create an art installation with generative audio. We want to use python to trigger different "scenes" within TidalCycles. I feel like I'm carefully following the instructions here, but am rather struggling to get TidalCycles to understand what's being sent.

First, I added this line to my BootTidal.hs file. The documentation said that TidalCycles listens on 6010 by default, but I did not find this to be the case.
tidal <- startTidal superdirtTarget (defaultConfig {cCtrlAddr = "", cCtrlPort = 6010})

I'm running TidalCycles in Pulsar, and it shows that it receives the OSC message, but clearly my syntax in incorrect in some way. How should I be changing the format of my message so that TidalCycles understands what I'm saying?

Hopefully this post can serve as a minimal example for others in the future!

My TidalCycles code:

d1 $ sound "bd*2" # gain (cF 1 "amp")

My Python code:

import time
from pythonosc import udp_client

# Define the IP address and port number of the TidalCycles OSC server
tidal_host = ""
tidal_port = 6010

# Create an OSC client to send messages to TidalCycles
osc_client = udp_client.SimpleUDPClient(tidal_host, tidal_port)

    osc_client.send_message("/ctrl/amp", 0.1)
    osc_client.send_message("/ctrl/amp", 0.8)

Error message:

Unhandled OSC: Message {messageAddress = "/ctrl/amp", messageDatum = [Float {d_float = 0.1}]}

I have not used OSC control myself but here is the OSC handler in Tidal: Tidal/src/Sound/Tidal/Stream.hs at 7a7669519ca9841daf288323db71041c479f45fb · tidalcycles/Tidal · GitHub

I don't see a receiver for /ctrl/amp. My guess bases on the docs is that this might work: /ctrl sf amp 0.1

1 Like

Thanks for pointing me to the OSC handler! With that pointer I was able to figure it out.

Correct syntax is

osc_client.send_message("/ctrl", ["amp", 1])