is there a good Nyquist compressor plug in för drums and guitar out there

I want to incorporate a compressor in my Binson echo plug in. Is there anybody that knows about one? I am aming for something smaller than Chris Chapels Dynamic Compressor.

Perhaps the “Soft Limiter” code from Audacity’s “Limiter” effect: https://github.com/audacity/audacity/blob/master/plug-ins/limiter.ny

Note that the lines beginning with “$” are equivalent to lines beginning with “;” but with the additional functionality (for plug-ins shipped with Audacity only) of supporting translation into other languages. The translations are built into Audacity (not the Nyquist code), so this translation mechanism works only for plug-ins that are shipped with Audacity. Translations use a function “_” (underscore), which tells Audacity “translate this”. Thus:

$name (_ "Limiter")

is equivalent to:

;name "Limiter"

where the former is the version for shipped plug-ins (translated) and the latter is for 3rd party plug-ins (not translated).

I have added to code to my Binson plugin, but can you describe the different modes, hard clip,soft clip, hard limit,soft limit? Does any of the modes correspond to a traditional compressor? I mean does the transfer function has a knee where above the gain is reduced?

“Soft Limit” has a “soft knee” whereas “Hard Limit” has a “hard knee” that starts much closer to the limit level.
Both of these settings are like traditional “compressors”, with fast “attack” and “release”, short “hold”, and a “lookahead” time equal to the attack time.

“Soft clip” and “hard clip” are “waveshaper” effects. “Hard clip” simply slices off any peaks that exceed the limit level. “Soft clip” is less brutal and “rounds off” the peaks rather than cutting them off flat. You could also consider these to be compressors with zero attack and release times, but the “soft clip” having a softer knee.

Thank you Steve!
Is it correct to say that the clipping effects work like an overdrive stompbox?
I do not see any way to control the compression ratio, or have I missed something?
Btw, the code for enabling preview of all tracks works great, and also the separate “Get selected track index”. Exactly what I wanted.

Pretty much yes. “Hard clipping” is like a “Fuzz box” effect.

The compression ratio varies with the “knee”. At the start of the knee curve, the compression ratio is 1:1 (no compression), and gradually increases toward the top of the knee. The top of the knee curve has a compression ratio “infinity:1” The top of the curve is the “limit level” and the output is guaranteed to not exceed this level.

The transfer function of the built in compressor plugin consists of two straight lines, up to the knee no compression (1:1), and above the knee a variable compression. Is it correct to say that the compression of the limiter corresponds to a curve where the angle at the start is 45 degrees (1:1) and at the top is horizontal (infinity:1)

Yes, except for “Hard clip”, which is 1:1 up to the limit level, then infinity:1 at the threshold (limit) level.