Controlling synths in carla with tidal

Hey! like the title says I'm trying to control synths loaded in the linux program Carla ( So I defined a custom OSC Target as follows:

let target =
Target {oName = "carla",
oAddress = "",
oPort = 22752,
oLatency = 0.2,
oSchedule = Live,
oWindow = Nothing
oscplay = [OSC "/Carla/0/set_volume" $ ArgList [("vol", Just $ VF 0.5)],
OSC "/Carla/0/set_parameter_value" $ ArgList [("param", Just $ VI 0), ("value", Just $ VF 0.5)]
oscmap = [(target, oscplay)]

stream <- startStream (defaultConfig {cCtrlListen = False}) oscmap

let c1 = streamReplace stream 1
vol = pF "vol"
param = pI "param"
value = pF "value"

this all works great. The problem I can't wrap my head around is that i really want to send MIDI notes to carla with /Carla/channel/note_on, but the thing is that once a note in Carla is "on" it has to be turned off again using /Carla/channel/note_off or there will be no further sound.. so I would have to send the "on message" wait for the length of the note and then send the "off message". Is there any way I could do this directly with Tidal? (I'm kind of avoiding to send the messages first to SC and then process them there because of latency)

hope someone can help,
all the best

Maybe you could define two OSC messages for note_on and note_off.

Then in tidal, you stack two patterns: the first one is for the note_on messages, and the second one is the same but time shifted with (~>) and sending note_off. Didn't try, but I think it could work.

It didn't quite work with two OSC messages, but in the end I pulled it off basically as you suggested but with two different OSC targets, where one is only for sending the note_off messages. Then I combined them like this:

c1 = streamReplace stream1
c2 = streamReplace stream2

c:: Show a => a -> ControlPattern -> IO()
c x p = sequence_ [((c1 x) p) , ((c2 x) $ ((0.001 <~) $ p))]

thank you ! :slight_smile: