# Lancetine

> Surgical parametric EQ: 24 dB/oct low and high cuts (off at their extremes), low and high shelves and three fully parametric bells.

- Engine id: `org.sournd.eq.lancetine`
- Category: EQ
- 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: 0 samples
- Tail: 0.2 s
- Sidechain input: no
- Channels: mono or stereo
- Audio demo: https://sournd.com/static/preview/demos/lancetine.mp3 (a drum loop, default settings)
- Live preview: https://sournd.com/engines/lancetine/ (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 | `low_cut_hz` | Low cut | 10 | 2000 | 10 | Hz | log |
| 1 | `low_shelf_hz` | Low shelf freq | 20 | 1000 | 100 | Hz | log |
| 2 | `low_shelf_db` | Low shelf gain | -18 | 24 | 0 | dB | linear |
| 3 | `bell1_hz` | Bell 1 freq | 20 | 20000 | 250 | Hz | log |
| 4 | `bell1_gain_db` | Bell 1 gain | -36 | 24 | 0 | dB | linear |
| 5 | `bell1_q` | Bell 1 Q | 0.1 | 18 | 1 | x | log |
| 6 | `bell2_hz` | Bell 2 freq | 20 | 20000 | 1000 | Hz | log |
| 7 | `bell2_gain_db` | Bell 2 gain | -36 | 24 | 0 | dB | linear |
| 8 | `bell2_q` | Bell 2 Q | 0.1 | 18 | 1 | x | log |
| 9 | `bell3_hz` | Bell 3 freq | 20 | 20000 | 4000 | Hz | log |
| 10 | `bell3_gain_db` | Bell 3 gain | -36 | 24 | 0 | dB | linear |
| 11 | `bell3_q` | Bell 3 Q | 0.1 | 18 | 1 | x | log |
| 12 | `high_shelf_hz` | High shelf freq | 1000 | 20000 | 8000 | Hz | log |
| 13 | `high_shelf_db` | High shelf gain | -18 | 24 | 0 | dB | linear |
| 14 | `high_cut_hz` | High cut | 1000 | 22000 | 22000 | Hz | log |
| 15 | `output_db` | Output | -18 | 18 | 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.eq.lancetine" };
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.eq.lancetine", &e) == SOURND_OK) {
    sournd_engine_prepare(e, 48000.0, 512);
    sournd_engine_set_param(e, 0, 10); /* Low cut */
    sournd_engine_process(e, in, out, 2, frames);
    sournd_engine_destroy(e);
}
```

## How it is made

Original sOURnd design blending general techniques: RBJ cookbook peaking and shelving biquads, cascaded Butterworth high- and low-pass sections, control-rate coefficient updates.

## Ask your AI

Paste this into your coding assistant:

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