# Pmono / "analog" style monosynth oscillator control?

Hii,

I'm trying to put together a TidalCycles set for a show in early Jan. I was wondering if it was possible to do this sort of thing from Tidal - see the Pmono pattern below:

(
SynthDef (\slide_test) {
var sig = SinOsc.ar (\freq.kr (440, \slide.kr (0)));
sig = Pan2.ar (sig, \pan.kr (0), \amp.kr (0.2));
Out.ar (0, sig);
)

(
Pmono (\slide_test,
\delta, 0.3,
\note, Pseq ([ 0, 4, 7, 2, 5 ], inf),
\slide, Pseq ([ 0, 0.3 ], inf),
).play;
)


Portamento (sometimes "gliss" or "slide") functionality is a pretty fundamental aspect of my workflow. Without having delved in properly yet, I feel like there might be some incongruence here with SuperDirt's paradigm? not sure.

also, for anyone who is confused by what's going on in the SynthDef, I'm using NamedControl syntax

This might be a clearer SynthDef:

(
SynthDef (\slide_test) {
arg freq = 440, slide = 0, pan = 0, amp = 0.2;
var lagged_freq, sig, panned_sig;

// if slide > 0, Lag2 portamentos to the new freq value
lagged_freq = Lag2.kr (freq, slide);

// the (potentially) portamento'ed freq value
// is given to the oscillator ugen
sig = SinOsc.ar (lagged_freq);

//  the output of the oscillator is panned
panned_sig = Pan2.ar (sig, pan, amp);

// and outputted
Out.ar (0, panned_sig);
)


but while the Pmono starts the synth and then gives the existing synth new arguments:

(
Pmono (\slide_test,
\delta, 0.3,
\note, Pseq ([ 0, 4, 7, 2, 5 ], inf),
\slide, Pseq ([ 0, 0.3 ], inf),
).play;
)


Tidal (SuperDirt?) wants to instantiate a new synth with each new note event, encased in its own envelope etc.

d1 \$ n "0 4 7 2 5" # s "slide_test" # pF "slide" "<0 0.3>"


neither prepending with mono nor smooth functions helps with this.

I think there are multiple ways to do this, but they generally involve a bit of Supercollider hacking. One thing that I've tried is something like this:

// get SuperDirt up and running, then
(
b = Bus.control(s);
Ndef(\bass, {|freq=60, drive=1, filter=1, portamento=0.2, wrate=1, amp=0.4|
var freqlag = Lag.kr(freq, portamento);
var sig = Lag.ar(Impulse.ar(freqlag+[0,1], [0,0.01*SinOsc.kr(1)]), [0.1,0.11], 100);
sig = LeakDC.ar(sig);
sig = 0.3*atan(sig*10*drive);
sig = RLPF.ar(sig, ([1300, 1100, 800]*filter+SinOsc.ar(wrate).range(100,500)).clip(20,8000), 0.3, [0.2, 0.3, 0.7]);
sig = Mix.ar(sig);
Out.ar(0,SplayAz.ar(2, sig*amp, 0.5));
}).gui;

This immediately creates a synth "outside" the usual SuperDirt hierarchy, but you can control a few of the parameters from Tidal by sending messages to the sbass synth. Putting the gui on the Ndef even gives you some sliders if you want to adjust things that way.
Pros: it's a true monosynth, you can send something like n "c c4 c c4 c c4 ef c c c4 g4 c c g4 ef c" # s "sbass" from Tidal and you'll get a nice portamento bassline (assuming you put that into the Ndef)
Cons: it's always playing, hush from Tidal does not turn it off, you need to change the amplitude manually or CMD-. to clear the Ndef. Being outside the normal SuperDirt hierarchy also means it does not have access to any of the effects, or really most parameters unless you explicitly include them. Though now that I think about it you could probably pipe the Ndef output into an orbit input so you could at least have global effects.