Coder Social home page Coder Social logo

Comments (3)

telephon avatar telephon commented on June 1, 2024 1

c = {

Just in general: better not use single letter variables in library code, because it may easily be broken by other code ...

I realize the problem with this is that dirt_monitor is a GlobalDirtEffect whose alwaysRun property is true, therefore the synth does never free and when commpressor ratio goes to 0, nothing is stopping it from a division by zero error.

I think you could arrange the parameter ranges in a way that this won't happen.

But then I also wonder how are dirt_reverb and friends freed when they simply stop being referenced?

This happens in DirtPause, which pauses when there hasn't been any message for graceTime. This is also how parameter values are kept (a paused synth keeps the values).

from superdirt.

telephon avatar telephon commented on June 1, 2024

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?

from superdirt.

ritchse avatar ritchse commented on June 1, 2024

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 GlobalDirtEffect whose alwaysRun property is true, therefore the synth does never free and when commpressor ratio goes to 0, nothing is stopping it from a division by zero error. But then I also wonder how are dirt_reverb and friends freed when they simply stop being referenced?

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;
};
)

from superdirt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.