0

I’m trying to set up TidalCycles to use inside Visual Studio Code, but I keep running into issues where it isn’t recognized correctly.

Here’s what I’ve installed so far:

  • SuperCollider (including SuperDirt)
  • Haskell via GHCup (including Cabal)
  • TidalCycles (using the command: cabal install tidal)

When I try to run TidalCycles from VSCode, evaluating d1$s"v" produces the error:

Command failed: D:\ghcup\ghcup\ghc\9.6.7\bin\ghc-pkg field tidal data-dir
ghc-pkg-9.6.7.exe: cannot find package tidal

It seems that tidal isn’t visible to GHC, even though I just installed it. I’ve spent hours trying to fix this and am completely stuck.

What are the correct steps to install and configure TidalCycles so that it functions properly in VSCode on Windows 10?

1 Answer 1

1

This checklist outlines the steps required to set up a complete TidalCycles live-coding environment, ensuring proper integration between TidalCycles, SuperCollider, and VS Code:

  1. Install Git for Windows (https://git-scm.com/downloads/win).

  2. Install SuperCollider (https://supercollider.github.io/downloads.html).

  3. Install SC3-Plugins for SuperCollider (https://github.com/supercollider/sc3-plugins/releases).

  4. Install SuperDirt via SuperCollider Quarks: Quarks.install("SuperDirt");

  5. Configure SuperCollider startup.scd to auto-boot SuperDirt: Open SuperCollider, navigate to File > Open startup file, paste the following script and save it:

/*
This is an example startup file.
If you want to modify it, best copy it elsewhere to keep the git repository clean.

You can then load it by calling
"path/to/my/superdirt_startup.scd".load
from the supercollider startup file

The supercollider startup file is to be found in
Platform.userAppSupportDir +/+ "startup.scd",
or via the menu File > Open startup file
*/


(
s.reboot { // server options are only updated on reboot
    // configure the sound server: here you could add hardware specific options
    // see http://doc.sccode.org/Classes/ServerOptions.html
    s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
    s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages
    s.options.numWireBufs = 2048; // increase this if you get "exceeded number of interconnect buffers" messages
    s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
    s.options.numOutputBusChannels = 2; // set this to your hardware output channel size, if necessary
    s.options.numInputBusChannels = 2; // set this to your hardware output channel size, if necessary
    // boot the server and start SuperDirt
    s.waitForBoot {
        ~dirt.stop; // stop any old ones, avoid duplicate dirt (if it is nil, this won't do anything)
        ~dirt = SuperDirt(2, s); // two output channels, increase if you want to pan across more channels
        s.sync; // remove annoying WARNING: Remote server failed to respond to rtMemoryStatus!
        ~dirt.loadSoundFiles;    // load samples (path containing a wildcard can be passed in)
        // for example: ~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*");
        ~dirt.start(57120, 0 ! 12);    // start listening on port 57120, create two busses each sending audio to channel 0
        SuperDirt.default = ~dirt; // make this instance available in sclang (optional)

        // optional, needed for convenient access from sclang:
        (
            ~d1 = ~dirt.orbits[0]; ~d2 = ~dirt.orbits[1]; ~d3 = ~dirt.orbits[2];
            ~d4 = ~dirt.orbits[3]; ~d5 = ~dirt.orbits[4]; ~d6 = ~dirt.orbits[5];
            ~d7 = ~dirt.orbits[6]; ~d8 = ~dirt.orbits[7]; ~d9 = ~dirt.orbits[8];
            ~d10 = ~dirt.orbits[9]; ~d11 = ~dirt.orbits[10]; ~d12 = ~dirt.orbits[11];
        );

        // directly below here, in your own copy of this file, you could add further code that you want to call on startup
        // this makes sure the server and ~dirt are running
        // you can keep this separate and make it easier to switch between setups
        // by using "path/to/my/file.scd".load and if necessary commenting out different load statements
        // ...

    };

    s.latency = 0.3; // increase this if you get "late" messages


};
);
  1. Install Haskell toolchain (https://www.haskell.org/ghcup/). It is assumed here that the installation root is D:\. Adjust paths if installed elsewhere. When running the installer, Cabal is required; other components are optional.

  2. Install TidalCycles library in PowerShell: cabal install --lib tidal

  3. Create a .ps1 file with the following contents and run it with PowerShell to register Tidal with GHC. Adjust $pkgDb and $ghcPkg paths accordingly:

# This script first clears the GHC user package database of all packages 
# (which removes duplicates and conflicts) and then re-registers all 
# configuration files found in the Cabal store.

$pkgDb = "D:\cabal\store\ghc-9.6.7\package.db"
$ghcPkg = "D:\ghcup\ghc\9.6.7\bin\ghc-pkg.exe"

Write-Host "--- 1. Listing and UNREGISTERING all existing user packages ---"

# 1a. Get a list of all package IDs in the user database.
# We capture the output string and use the -split operator to reliably 
# create an array of individual IDs separated by whitespace.
$packagesString = & $ghcPkg list --user --simple-output
$packagesToUnregister = $packagesString -split '\s+' | Where-Object { $_ }

# 1b. Iterate through the list and unregister each one
if ($packagesToUnregister.Count -gt 0) {
    foreach ($pkgId in $packagesToUnregister) {
        Write-Host "Unregistering: $pkgId"
        # Unregister each package one by one. --force is essential here.
        # Errors (which are common during cleanup) are suppressed using Out-Null.
        & $ghcPkg unregister $pkgId --user --force | Out-Null
    }
    # 1c. Rerun recache after cleanup to finalize the empty state
    Write-Host "Recaching database after unregistration..."
    & $ghcPkg recache --user
} else {
    Write-Host "User package database is already empty."
}

Write-Host ""
Write-Host "--- 2. Registering all Cabal store packages with updated metadata ---"

# This step re-registers all configuration files (.conf) found in the Cabal store.
# Since we cleared the registry above, this ensures a clean, single entry for each package.
Get-ChildItem -Path $pkgDb -Filter *.conf | ForEach-Object {
    Write-Host "Registering package:" $_.FullName
    & $ghcPkg --user register --force $_.FullName
}

Write-Host ""
Write-Host "--- Registration complete. Your package database is now clean. ---"
Write-Host "Press any key to exit." -NoNewline
[void][System.Console]::ReadKey($true)
  1. Install the TidalCycles for VSCode extension from the Marketplace. (Optional) Also consider installing the Haskell Syntax Highlighting Support extension for better file recognition.

  2. Configure VSCode Settings (JSON): Add the following configuration to your settings.json to set the GHCi executable path and associate .tidal files with Haskell syntax highlighting:

"tidalcycles.ghciPath": "D:\\ghcup\\ghc\\9.6.7\\bin",
"files.associations": {
    "*.tidal": "haskell"
}
  1. Test Setup: Launch SuperCollider, open a new .tidal file in VS Code, and evaluate the following code with Shift+Enter:

d1 $ slow 9 $ n (run 9) # s "fm"

If you hear a beat, the setup is complete.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.