Question. 1 steam, but different 2 SCs can only listen to some "parts" of the stream?

Hi,

I'm working on customizing OSC messages for several days, but I still couldn't find the best solution.

I've found u-he repro-5 is an amazing VST synth, but it also costs too much CPU power. My main machine is windows, and I thought this might reduce CPU cost on my windows and get only the great sounds if I could have my old MacBook run the repro-5 and get back only the sound to my windows.

This is my blueprint.

My main editor is Atom on my windows. I'd like to seamlessly apply the basic tidal functions (including transition functions) for sounds from SC on my windows and sound from my MacBook. So, I thought the number of the "stream" should be 1 (SCs on my windows and my MacBook listen to the same stream from Tidal on my windows). This is my current BootTidal.hs.

:{
let macTarget =
      Target {oName = "mac",   -- A friendly name for the target (only used in error messages)
              oAddress = "192.168.1.2", -- The target's network address, normally "localhost"
              oPort = 57120,           -- The network port the target is listening on
              oLatency = 0.1,         -- Additional delay, to smooth out network jitter/get things in sync
              oSchedule = Live,       -- The scheduling method - see below
              oWindow = Nothing,      -- Not yet used
              oHandshake = False,     -- SuperDirt specific
              oBusPort = Nothing      -- Also SuperDirt specific
             }
:}

:{
let localTarget =
      Target {oName = "local",   -- A friendly name for the target (only used in error messages)
              oAddress = "127.0.0.1", -- The target's network address, normally "localhost"
              oPort = 57120,           -- The network port the target is listening on
              oLatency = 0.62,         -- Additional delay, to smooth out network jitter/get things in sync
              oSchedule = Live,       -- The scheduling method - see below
              oWindow = Nothing,      -- Not yet used
              oHandshake = False,     -- SuperDirt specific
              oBusPort = Nothing      -- Also SuperDirt specific
             }
:}

:{
tidal <- startStream (defaultConfig {cVerbose = True, cCtrlAddr = "0.0.0.0"}) [
                                                              (localTarget, [superdirtShape])
                                                              ,
                                                              (macTarget, [superdirtShape])
                                                              ]
:}

However, using this BootTidal.hs code, my SCs on windows and MacBook listen to the same OSC messages and they try to run the same sounds. I've tried many things to avoid the "duplicated" sounds from windows and MacBook, but the current solution is to add an if statement in SuperDirt.sc.

                // In SuperDirt.sc. force only play sound "midi0".
				msg.do({ arg item, i;
					if( item == 'midi0',{
						// msg.postln;
						DirtEvent(orbits @@ index, modules, event).play
					});
				});

It's obviously ugly. Would there be better Haskell codes on BootTidal.hs to fit my demands?

2 Likes

Yes, this is more or less what the OSC "shapes" are for. You can define variants on the built-in superdirtShape like so:

localShape = OSC "/dirt/play" $ Named {requiredArgs = ["s", "localFlag"]}
macShape = OSC "/dirt/play" $ Named {requiredArgs = ["s", "macFlag"]}

Then you'd associate each shape with the appropriate target:

tidal <- startStream (defaultConfig {cVerbose = True, cCtrlAddr = "0.0.0.0"}) [
                                                              (localTarget, [localShape])
                                                              ,
                                                              (macTarget, [macShape])
                                                              ]

Then you could generate patterns with the correct flag param (The 1 is an irrelevant placeholder value here. The only thing that the shape cares about is the presence or absence of a parameter):

local = pI "localFlag" 1
mac = pI "macFlag" 1

From there, then you can append those as needed:

-- this one goes to local superdirt
d1 $ s "bd cp" # local

-- this one goes to the synth
d2 $ n "0 1 2 3" # s "midi" # mac
2 Likes

Oh! That's what I'd like to do...
I've also been tinkering with the "shape." but I must have misunderstood the functional benefit of the "requiredArgs."

Now, I'm quite happy with it. Thank you very much! @mindofmatthew

1 Like