The built-in compressor

Hi,

I’m struggling with the built-in Tracktion compressor plugin – no matter what values I set I can’t hear any difference in sound. Is there an example somewhere of how to create and insert a compressor programatically?

Erik

For reference, this is how the compressor is currently created and initialized in my code:

    for (int t = 0; t < audioTracks; t++) {
        auto track = getSongAudioTrack(t);  // Helper
        track->setName("Audio " + juce::String(t));
        auto reverb = song->getPluginCache().createNewPlugin (te::ReverbPlugin::xmlTypeName, {});
        auto eq = song->getPluginCache().createNewPlugin (te::EqualiserPlugin::xmlTypeName, {});
        auto comp = song->getPluginCache().createNewPlugin (te::CompressorPlugin::xmlTypeName, {});
        track->pluginList.insertPlugin(reverb, 0, &selectionManager);
        track->pluginList.insertPlugin(eq, 0, &selectionManager);
        track->pluginList.insertPlugin(comp, 0, &selectionManager);
    }


...


void setCompressorParamsFromJson(te::CompressorPlugin& plugin, const sajson::value& params)
{
    if (params["ratio"].is_number()) {
        plugin.setRatio(params["ratio"].get_number_value());
    }
    if (params["threshold"].is_number()) {
        plugin.setThreshold(params["threshold"].get_number_value());
    }
    if (params["attack"].is_number()) {
        plugin.attackMs->setParameter(jlimit(0.3, 200.0, params["attack"].get_number_value()), sendNotification);
    }
    if (params["release"].is_number()) {
        plugin.releaseMs->setParameter(jlimit(10.0, 300.0, params["release"].get_number_value()), sendNotification);
    }
    if (params["gain"].is_number()) {
        plugin.outputDb->setParameter(jlimit(-10.0, 24.0, params["gain"].get_number_value()), sendNotification);
    }
}

The EQ and reverb works as expected but I can’t hear any noticable sound difference when tweaking the values of the compressor, even with extreme values. So apparently I’m doing something wrong!

If you put a breakpoint in the process block, are the values being used what you expect?

Yes they are! And actually – I just realized that the compressor does work!

It’s just that I have to set much more extreme values than I’m used to seeing when mixing. But it may just be that I haven’t been working with raw values in this way before…

Sorry about the noise!

TBH, that compressor is over 20 years old and isn’t very feature rich and probably isn’t what you’re after. I think there may be something not-quite-right with the ratio calculation but we couldn’t change it due to people’s sessions relying on it.

You’re probably better off rolling your own.

Allright, thanks! :smile:

also consider that the cool workflow that you experience in most popular compressor plugins doesn’t only come from the compressor algorithm itself or even the parameters ranges, but also from the way their ranges are distributed across the parameter. for example when it comes to attack parameters a lot of plugins give you around half the parameter only for small values like 1-40ms, but the other half of the parameter can go very wide, maybe even multiple secounds long. that is because humans don’t perceive that much of a difference at these higher times anymore, so parameters don’t need to be very precise up there. yet they do have to reach those values because sometimes you need something like that. closely look at your favourite compressors’ parameter values while turning them and you’ll see