Skip to content
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

Limiter overshooting with large numbers #5274

Open
dkmayer opened this issue Dec 1, 2020 · 3 comments
Open

Limiter overshooting with large numbers #5274

dkmayer opened this issue Dec 1, 2020 · 3 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: server plugins

Comments

@dkmayer
Copy link
Contributor

dkmayer commented Dec 1, 2020

SC 3.11.1 on OS 10.15

Limiter doesn't suppress single peaks with sudden large numbers. The help file is a bit misleading in this regard as it says: "Limiter will not overshoot like Compander"

// two peaks

{ Limiter.ar(SinOsc.ar(100, 0, 2 ** 30), 0.01) }.plot(0.05)

{ Limiter.ar(SinOsc.ar(100, 0, 2 ** 30), 0.01) }.plot(1)


The second plot might suggest that it could be an init time issue, but it isn't:

{ Limiter.ar(LFPulse.ar(10, mul: 2 ** 30), 0.01) }.plot(1)

The same behaviour can be observed with Normalizer.

Daniel

@dkmayer dkmayer added the bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. label Dec 1, 2020
@capital-G
Copy link
Contributor

I started looking at this.

Limiter is just a 1:1 name-wrapper for Normalizer which contradicts the credo

There should be one-- and preferably only one --obvious way to do it.

of another big programming language. Another not so nice thing about this is that there are docs for each of this functions although they are the same. But back to topic:

Interestingly, there is a Limiter Ugen which is probably never used.
The naive idea to simply switch the Limiter to its designated UGen did not fix the bug - but this is no suprise as both UGen look quite similar.

There is probably some kind of bug in the calculation of the slope which is applied here as

LOOP(nsmps, ZXP(xinbuf) = val = ZXP(in); ZXP(out) = level * ZXP(xoutbuf); level += slope;
val = std::abs(val); if (val > curmaxval) curmaxval = val;);

but its my first look at a Ugen so I still need some time to figure out whats going on exactly.

@joshpar
Copy link
Member

joshpar commented Dec 4, 2020 via email

@telephon
Copy link
Member

telephon commented Dec 4, 2020

To extend josh's explanation: there is code in sclang that is just an interface code. Some few cases of this you'll find in methods whose body is replaced by a more efficient version by the interpreter. But UGens are always just names that are used to build a SynthDef which specifies hoe the scsynth builds its graph.

Btw. SuperCollider does explicitly not follow that particular line in the python credo. If I tried to formulate a counter-line: there should always be several obvious ways to do something (In order to be able to do things right, you have to have several ways to do the same thing).

For good or bad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: server plugins
Projects
None yet
Development

No branches or pull requests

5 participants