Coder Social home page Coder Social logo

Original dirty compressor about superdirt HOT 7 OPEN

yaxu avatar yaxu commented on September 27, 2024
Original dirty compressor

from superdirt.

Comments (7)

ahihi avatar ahihi commented on September 27, 2024 2

yeah, that could end up being the best option and surely would run the fastest. i have been meaning to learn SC plugin development anyway.. might be a few weeks till i have the time though.

from superdirt.

ahihi avatar ahihi commented on September 27, 2024 1

as per the Fb1 docs, that does not work:

What cannot / shouldn't be done (ar case considerations):

Writing ar UGens in func that produce a time-varying signal itself (e.g. SinOsc.ar, in contrast to SinOsc.kr and operator UGens like '+', '*' etc.) - instead, if such ar UGens aren't applied to data from inside func, they can be passed via Fb1's and func's 'in' arg. It remains the case of such ar UGens that should process data that is provided by func (e.g. letting the fb out modulate a parameter of a VarSaw.ar). This is currently not possible and I don't have a clear picture if and how it would be possible at all or if it would make much sense.

i do think the current version sounds good, but would like to match the original.

edit: i do also use Compander a lot, but the goal here was to reimplement the algorithm from Dirt ^^

from superdirt.

telephon avatar telephon commented on September 27, 2024

The UGen is a control rate ugen (Select.kr) so it doesn't need Fb1 really.

Can't test it right now, but this should be about what is needed:

(
Ndef(\dirtComp, { |amount=1, speed=50|
	var input, max, env, n, prod;
	var ctrl;
	n =  2; //~dirt.numChannels;
	input = In.ar(0, n);
	ctrl = input[0];// maybe we want to multichannel expand or sum rathen than taking the first channel?

	max = ArrayMax.ar(input.abs);
	env = LocalIn.kr(n);
	env = env + (speed / SampleRate.ir); // needs fix: making it depend on the sample rate and on block size 
	prod = (ctrl * env).abs;
	env = Select.kr(prod > 1, [env, env/prod]);
	LocalOut.kr(env);
	ReplaceOut.ar(0, input * amount.linlin(0, 1, 1, env * 0.2));
}).play(
	group: RootNode(Server.default),
	addAction: \addToTail
);
)

It would be good if we could just add the Fb1 part of the library otherwise, yes!

from superdirt.

ahihi avatar ahihi commented on September 27, 2024

The UGen is a control rate ugen (Select.kr) so it doesn't need Fb1 really.

that is a mistake on my part. the original C code runs this conditional at audio rate, but i am not entirely sure how to achieve that here.

from superdirt.

telephon avatar telephon commented on September 27, 2024

Ah I see, well, all you have to do is to use a Select.ar in the Fb1. But if it sounds good as it is now, maybe that is not necessary? Btw. have you checked the Compander UGen? (here is the source: https://github.com/supercollider/supercollider/blob/71d5d1841bc1b26a59560c6544f3996765f6ff63/server/plugins/FilterUGens.cpp#L3242). It may be similar, but I am not sure. Also there is a CompanderD, a slightly different one.

Just to be sure!

from superdirt.

telephon avatar telephon commented on September 27, 2024

Another idea: What about writing the thing as a ugen plugin? We could add it to sc3plugins.

from superdirt.

telephon avatar telephon commented on September 27, 2024

Most people say it is quite easy. You could take Compander as a starting point.

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.