# Brimm

> Clipper: shaves peaks at a ceiling you set, with a hard, soft or knee corner, oversampled for clean highs. Push the drive for loudness and bite, or keep it low to catch stray transients.

- Engine id: `org.sournd.distortion.brimm`
- Category: Distortion
- Licence: free (Apache-2.0, in the open framework)
- Download (no account or email): https://sournd.com/download/free/macos (macOS universal), https://sournd.com/download/free/linux (Linux x86_64 and aarch64) or https://sournd.com/download/free/windows (Windows x64). One archive with every free engine: static library, C headers, README.
- Version: 1.0.0
- Latency: 15 samples
- Tail: 0.01 s
- Sidechain input: no
- Channels: mono or stereo
- Audio demo: https://sournd.com/static/preview/demos/brimm.mp3 (a bass line, default settings)
- Live preview: https://sournd.com/engines/brimm/ (runs the real engine in the browser; test sounds or the user's own file)

## Parameters

The id is the C ABI parameter id and the JUCE parameter id (as a decimal string).

| Id | Key | Name | Min | Max | Default | Unit | Taper |
|---|---|---|---|---|---|---|---|
| 0 | `drive_db` | Drive | 0 | 36 | 0 | dB | linear |
| 1 | `ceiling_db` | Ceiling | -24 | 0 | -1 | dB | linear |
| 2 | `shape` | Shape | 0 | 2 | 2 | - | linear |
| 3 | `knee_db` | Knee | 0 | 12 | 3 | dB | linear |
| 4 | `mix` | Mix | 0 | 100 | 100 | % | linear |
| 5 | `output_db` | Output | -24 | 12 | 0 | dB | linear |

## Use it in JUCE

CMake ([quick start](/docs/juce/index.md)):

```cmake
juce_add_module(path/to/sournd_engine)
target_include_directories(MyPlugin PRIVATE path/to/include)
target_link_libraries(MyPlugin PRIVATE sournd_engine path/to/libsournd_cabi.a)
```

C++:

```cpp
#include <sournd_engine/sournd_engine.h>

sournd::SourndEngine engine { "org.sournd.distortion.brimm" };
juce::AudioProcessorValueTreeState parameters { *this, nullptr, "Parameters",
    sournd::SourndEngineParameters::createLayout (engine) };
sournd::SourndEngineParameters bridge { engine, parameters };

// prepareToPlay
engine.prepare ({ sampleRate, (juce::uint32) maximumBlock, 2 });
bridge.prepare (sampleRate);
setLatencySamples ((int) engine.latency());

// processBlock
bridge.apply ((uint32_t) buffer.getNumSamples());
juce::dsp::AudioBlock<float> block { buffer };
engine.process (juce::dsp::ProcessContextReplacing<float> { block });

// get/setStateInformation: hold getCallbackLock() around saveState / loadState,
// so state work never overlaps processBlock (full example: /docs/juce/)
```

Plain C:

```c
sournd_engine *e = NULL;
if (sournd_engine_create("org.sournd.distortion.brimm", &e) == SOURND_OK) {
    sournd_engine_prepare(e, 48000.0, 512);
    sournd_engine_set_param(e, 0, 0); /* Drive */
    sournd_engine_process(e, in, out, 2, frames);
    sournd_engine_destroy(e);
}
```

## How it is made

Original sOURnd design blending general techniques: drive into a ceiling-normalised static clipper with hard, hyperbolic-tangent or quadratic soft-knee transfer curves, run inside 2x windowed-sinc oversampling with the dry blend at the oversampled rate.

## Ask your AI

Paste this into your coding assistant:

```text
Add the sournd engine org.sournd.distortion.brimm to my JUCE plugin. Follow https://sournd.com/docs/juce/index.md
and the engine reference at https://sournd.com/engines/brimm/index.md. Expose every parameter through APVTS.
```
