OSC: Tidal and Processing

Hey all,

I am trying to connect Tidal to processing, in which I'm using a Kinect v2 sensor to skeleton track people in a room.
I saw this: https://blog.tidalcycles.org/tidalcycles-and-processing/
But the GitHub looks quite old, just wondering if anyone has any good tips on using OSC with tidal, or any examples?

Thanks in advance, hope everyone is well :slight_smile:

just to be clear - I'm trying to send messages from processing to tidal, not the other way around.

Yes that post is about sending stuff from tidal to processing I think.

When you start tidal it says something about listening to port 6010 - that's where you can send OSC from processing. You basically send to the /ctrl path, and add a string that is a name for the value, and the value itself. Here's an example that sends the x position of the mouse (from 0 .. 1) when you click it on the processing window.

import oscP5.*;
import netP5.*;
  
OscP5 oscP5;
NetAddress tidal;

void setup() {
  size(400,400);
  frameRate(25);
  oscP5 = new OscP5(this,12000);
  tidal = new NetAddress("127.0.0.1",6010);
}


void draw() {
  background(0);  
}

void mousePressed() {
  /* in the following different ways of creating osc messages are shown by example */
  OscMessage myMessage = new OscMessage("/ctrl");
  myMessage.add("mousex");
  myMessage.add((float)mouseX/(float)width);
  println((float)mouseX/(float)width);
  /* send the message */
  oscP5.send(myMessage, tidal); 
}

Here's an example of reading that value:

d1 $ sound "bd*8" # pan (cF0 "mousex")

There's a bit more info here:

It would be good to make this page clearer with more examples though.

is there a way to display the current value of a control in tidal?

when I run something like show (cF0 "mousex") , it always just prints "(0>1)|0.0", no matter what value I set it to via OSC.

Yes true, a pattern doesn't have access to the control data until it's run within a tidal 'stream'.

There's no 'official' way to show the state but I've just had a look and this works:

import Control.Concurrent.MVar

readMVar $ sStateMV tidal

I'll make a note to make something friendlier..

1 Like

Edit: never mind, solved it by updating :slight_smile:

hmm, I get this error:

Variable not in scope: sStateMV :: Stream -> MVar a

even after importing Sound.Tidal.Stream .

Ah yes before 1.7.2 I think this would work instead:

import Control.Concurrent.MVar

readMVar $ sInput tidal