ktyl ~ blog

Wading into Tidal

I stumbled across TidalCycles lately. It exists at my happy cross-section of automation, rave music and open source software. It's a livecoding language/interpreter/instrument based on Haskell (in which I am also particularly interested!) and I decided to try it out.

This is a short post explaining the steps I took and resources I used to install and get started playing with Tidal on Arch Linux using Neovim.

Realtime Scheduling

Similarly to a DAW - I suppose Tidal is kind of a DAW? Audio engineers will squirm - it's important for Tidal to have high-precision timing, unlike most software. This kind of control can be risky, so most systems don't make it available straight out the gate - Arch is one of them. See this post for a more detailed explanation, as well as a list of distributions which do enable realtime scheduling straight away. In my case, I found a section on the JACK ArchWiki page that provided an easier solution. Install the realtime-privileges package and add your user to it:

sudo pacman -S realtime-privileges
sudo usermod -a -G realtime ktyl

As with all group changes, you'll need to re-log or reboot for changes to take effect.

Linux Audio

There are three components to my local audio setup in the context of Tidal. First is JACK, which is a low-latency audio daemon with a confusing number of implementations. There is a list and comparison on the ArchWiki page, but I found the package I needed to install was pipewire-jack (as opposed to jack or jack2), which leads nicely into Pipewire, the second component.

Pipewire is a multimedia framework which aims to solve audio problems on Linux Once And For All. It's an abstraction and doesn't directly play audio itself, rather deferring that responsibility further down the line.

To actually play audio, I am using the PulseAudio which I already had installed. However, this didn't work out of the box because Pulse and Pipewire had no idea about each other. To resolve this, I had to install the pipewire-pulse package.

SuperCollider and SuperDirt

Now we're getting to the fun stuff! I mostly followed this guide, but I found I had to do a couple things a little differently - maybe it's a bit of a dated guide? - which I'll describe here.

First I installed haskell-tidal from the AUR (I use the yay AUR helper. Then, as I wanted to use Neovim, I had to install the tidalcycles/vim-tidal plugin, using the vim-plug plugin manager, and remembering to run :PlugUpdate.

The guide then describes steps to make the tidal binary available system-wide - however I found the path it describes didn't exist. Instead, based on the path vim-plug installs to (~/.local/share/nvim/ rather than ~/.config/nvim/), I found my actual steps were:

cd ~/.local/share/nvim/plugged/vim-tidal
sudo make install

Next I opened SuperCollider with scide and installed SuperDirt. Again the guide seemed a bit out of date in the version of SuperDirt it lists - I found I needed to use "v1.7.2" as the version string, rather than "v1.1.3" as shown in the guide. By the time you're reading this, the version listed here may be out of date, so if you have trouble with this stage that's what I'd check first.

Quarks.checkForUpdates({Quarks.install("SuperDirt", "v1.7.2");
thisProcess.recompile()})

To run code in SuperCollider, select the block you'd like to execute and press Ctrl + Enter.

At this stage, everything should be installed (notwithstanding any error messages, troubleshooting section not included) and we should be ready to go.

Start SuperDirt up in SuperCollider:

SuperDirt.start;

Now, open a tidal file in Neovim:

nvim test.tidal

And enter a Tidal pattern!

d1 $ sound "bd sn"

To play it, put the cursor in the line and press Ctrl + E. Neovim should open a new window containing a Tidal terminal, and find and connect to the runing Tidal instance.

That's it! Have fun making beats. If you have any trouble with this guide, there's an off chance I've learned a bit more about in the interim, so feel free to ping me an email! Or of course, ask the nice folk over at Tidal Club.