-
Notifications
You must be signed in to change notification settings - Fork 78
Q: How do default arguments in the SynthDefs SuperDirt use work? #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This isn't set anywhere, the synths are just freed and when a new one comes to life, it has new parameters. We need to think about whether it is tidal's or superdirt's job to keep these values. @yaxu what do you think? For completeness, can you post some code? |
I was working again on the idea of adding a compressor that can also do sidechain compression from any orbit. As discussed on #251 and with what I learned from your post about orbit routing in the club. I thought a good idea might be to just add the compressor inside the dirt monitor, since I see it as a final process before limiting and I thought it might have been as easy as adding it in. I realize the problem with this is that dirt_monitor is a Also, I started this issue with the same question in mind. "Tidal or SuperDirt to keep default values?", after all I do know how to set that from Tidal in some way. But I decided to go for the SuperDirt route to keep all my code on the SC side. Hence this issue. Anyway here's my code, messy as it is rn: (
~dirt.orbits.do { |x|
var l = x.globalEffects.size;
x.globalEffects[4] = GlobalDirtEffect(\dirt_monitor,['limitertype','comp','thresh','atktime','reltime','upcomp','makeup','sidechain']);
x.initNodeTree;
};
~dryBuses = [];
~dirt.orbits.do { |x|
~dryBuses = ~dryBuses ++ x.dryBus
};
c =
{|signal, comp=1, thresh=0.5, atktime=0.01, reltime=0.1, upcomp=1, makeup=1, sidechain=(-1)|
var sound, control, chs;
chs = ~dirt.numChannels;
//control = In.ar(Select.kr(sidechain+1,[signal]++~dryBuses),2);
control = signal;
Compander.ar(signal, control, thresh: thresh, slopeAbove: (1/(comp+0.00001)),
clampTime: atktime, relaxTime: reltime, mul: makeup+0.00001, slopeBelow: (1/(upcomp+0.00001)));
};
d = SynthDef("dirt_monitor" ++ ~dirt.numChannels, { |dryBus, effectBus, outBus, gate = 1, limitertype = 1|
var drySignal = In.ar(dryBus, ~dirt.numChannels);
var wetSignal = In.ar(effectBus, ~dirt.numChannels);
//var signal = XFade2.ar(wetSignal, drySignal, dry * 2 - 1);
var signal = wetSignal + drySignal;
var post = if(SuperDirt.postBadValues) { 2 } { 0 };
signal = SynthDef.wrap(c,[\ir,\kr,\kr,\kr,\kr,\kr,\kr,\kr],[signal]); // compressor
signal = Select.ar(CheckBadValues.ar(signal, post: post) > 0, [signal, DC.ar(0)]);
signal = Select.ar(limitertype,
[
signal,
Limiter.ar(signal),
softclip(signal * 0.5) * 2
]
);
DirtPause.ar(signal, graceTime:4);
signal = signal * EnvGen.kr(Env.asr, gate, doneAction:2);
Out.ar(outBus, signal)
}, [\ir, \ir, \kr, \kr, \kr],nil);
d.add;
s.freeAll;
~dirt.orbits.do { |x|
var l = x.globalEffects.size;
x.globalEffects[4].paramNames = ['limitertype', 'comp', 'thresh', 'atktime', 'reltime', 'upcomp', 'makeup', 'sidechain'];
x.initNodeTree;
};
) |
Just in general: better not use single letter variables in library code, because it may easily be broken by other code ...
I think you could arrange the parameter ranges in a way that this won't happen.
This happens in |
I realize some synthdefs (like the reverb one) automatically go back to their default values when they stop being referenced in tidal code. For example setting the
size
of the reverb to 0.5, then removing that from the code and have it go back to 0.1.Where is this set? With regular SC synthdefs setting arguments to
nil
just sets them to0
.The text was updated successfully, but these errors were encountered: