Can't get OSC to work, what am I missing? (VS Code with Tidal extension)

hey there! i'm stuck at setting up OSC with my tidal setup. i have tried many different ways (e.g. different indentations, pasting the code from the official docs in a .tidal vs. a .hs file, etc.). the intent once that's done is to communicate with ableton.

i'm in VS Code with the tidal extension setup, set to read my custom BootTidal.hs file at the root of my project. i wrote a separate OSC.hs file to set the OSC targets & streams, loaded from the BootTidal.hs file. but even by pasting the code in the same file it doesn't work.

the way i'm testing my setup is by running x1 $ s "hello" # cut 1 # intensity 1, as suggested in the docs.
i've been getting indent issues, or syntax: :script <filename> error when loading :script ./OSC.hs. as far as i understand these errors have to do with haskell specificities which are beyond me as i don't know haskell.

here is my my latest implementation with VS Code, Tidal extension & custom BootTidal.hs at root of directory:

:set -fno-warn-orphans -Wno-type-defaults -XMultiParamTypeClasses -XOverloadedStrings
:set -package tidal-core

:set prompt "tidal> "
:set prompt-cont ""

import Sound.Tidal.Context
import Sound.Tidal.Boot

default (Rational, Integer, Double, Pattern String)

tidalInst <- mkTidal

instance Tidally where tidal = tidalInst

let glassPc = sound "bifs-glass-piece"
    metalTxt = sound "bifs-metal-texture"
    beep = sound "bifs-beep"

:script "/Users/<username>/Library/Application Support/SuperCollider/synthdefs/mi-ugens-params.hs"

:{
let target = Target {oName = "ableton",
                     oAddress = "localhost",
                     oPort = 5050,
                     oLatency = 0.2,
                     oSchedule = Live,
                     oWindow = Nothing,
                     oHandshake = False,
                     oBusPort = Nothing
                    }
    oscplay = OSC "/play" $ ArgList [("s", Nothing),
                                     ("vowel", Just $ VS "a"),
                                     ("pan", Just $ VF 0.5),
                                     ("volume", Just $ VF 1),
                                     ("cut", Just $ VI 1),
                                     ("intensity", Just $ VI 0)
                                    ]
    intensity = pF "intensity"
    oscmap = [(target, [oscplay])]
:}

stream <- startStream defaultConfig oscmap

:{
let x1 = streamReplace stream 1
    x2 = streamReplace stream 2
    x3 = streamReplace stream 3
    x4 = streamReplace stream 4
:}

and the error i get when running smth like x1 $ s "db", using the tidal extension commands ctrl+enter:

2025-11-14 11:25:50.083 [error] tidal>  
 [GHC-88464]
    Variable not in scope: x1 :: ControlPattern -> b
    Suggested fix: Perhaps use ‘d1’ (imported from Sound.Tidal.Boot)

2025-11-14 11:25:50.090 [info] tidal>  

i'm at a loss with what options to try at this point, welcoming suggestions or working examples <3

System info:

OS: Macos
Installation: cabal
Code editor: VS Code
SuperCollider version: 3.14.0
SuperDirt version: 1.7.3?
GHC version: 9.6.7
Tidal version: 1.10.1
Audio device & protocol: internal speakers
Audio card: none

i got things to work but ultimately abandoned the effort after finding out that ableton/max don't have ready made devices for me to work with osc – or it's requiring more research time that i don't have right at the moment. i resorted to sending CC messages to Ableton Live to control parameters.

what likely solved my issue was switching localhost to 127.0.0.1, replacing the tidalInst lines by this tidal <- startStream defaultConfig oscmap, and trying the setup with d1 $ s “db” # oscParam1 0.4 # oscParam2 0.75 instead of using x1 $ … (see example below).

my working TidalBoot.hs file looks like this (following other examples in forums on the topic like this one, especially the previous official suggestion for the tidal boot file):

:set -XOverloadedStrings
:set prompt ""

import  Sound.Tidal.Context

import System.IO (hSetEncoding, stdout, utf8)
hSetEncoding stdout utf8

:{
let target = Target { oName = "Max",   
                      oAddress = "127.0.0.1", 
                      oPort = 5050,      
                      oLatency = 0.2,         
                      oSchedule = Live,       
                      oWindow = Nothing,      
                      oHandshake = False,     
                      oBusPort = Nothing      
                    }
    oscplay = OSC "/play" $ ArgList [("s", Nothing),
                                     ("vowel", Just $ VS "a"),
                                     ("pan", Just $ VF 0.5),
                                     ("volume", Just $ VF 1),
                                     ("cut", Just $ VI 1),
                                     ("Send-B", Just $ VF 0.7)]
    oscmap = [(target, [oscplay]), (superdirtTarget {oLatency = 0.05}, [superdirtShape])]
    sendB = pF "Send-B"
:}

tidal <- startStream defaultConfig oscmap

:{
let only = (hush >>)
    p = streamReplace tidal
    hush = streamHush tidal
    panic = do hush
               once $ sound "superpanic"
    list = streamList tidal
    mute = streamMute tidal
    unmute = streamUnmute tidal
    unmuteAll = streamUnmuteAll tidal
    unsoloAll = streamUnsoloAll tidal
    solo = streamSolo tidal
    unsolo = streamUnsolo tidal
    once = streamOnce tidal
    first = streamFirst tidal
    asap = once
    nudgeAll = streamNudgeAll tidal
    all = streamAll tidal
    resetCycles = streamResetCycles tidal
    setCycle = streamSetCycle tidal
    setcps = asap . cps
    getcps = streamGetcps tidal
    getnow = streamGetnow tidal
    xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i
    xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i
    histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i
    wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i
    waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i
    jump i = transition tidal True (Sound.Tidal.Transition.jump) i
    jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i
    jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i
    jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i
    jumpMod' i t p = transition tidal True (Sound.Tidal.Transition.jumpMod' t p) i
    mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i
    interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i
    interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i
    clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i
    clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i
    anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i
    anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i
    forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i
    d1 = p 1 . (|< orbit 0)
    d2 = p 2 . (|< orbit 1)
    d3 = p 3 . (|< orbit 2)
    d4 = p 4 . (|< orbit 3)
    d5 = p 5 . (|< orbit 4)
    d6 = p 6 . (|< orbit 5)
    d7 = p 7 . (|< orbit 6)
    d8 = p 8 . (|< orbit 7)
    d9 = p 9 . (|< orbit 8)
    d10 = p 10 . (|< orbit 9)
    d11 = p 11 . (|< orbit 10)
    d12 = p 12 . (|< orbit 11)
    d13 = p 13
    d14 = p 14
    d15 = p 15
    d16 = p 16
:}

:{
let getState = streamGet tidal
    setI = streamSetI tidal
    setF = streamSetF tidal
    setS = streamSetS tidal
    setR = streamSetR tidal
    setB = streamSetB tidal
:}

:set prompt "tidal> "

default (Rational, Integer, Double, Pattern String)