# Swoopline

> Octave up straight from the waveform: glassy and clean on one side, ringing and fuzzy on the other, with drive, a gate that trims the tails and a tone control. No latency.

- Engine id: `org.sournd.pitch.swoopline`
- Category: Pitch
- Licence: free: a closed library, free to use in your plugins, downloaded with no account or email
- 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.1 s
- Sidechain input: no
- Channels: mono or stereo
- Audio demo: https://sournd.com/static/preview/demos/swoopline.mp3 (plucked chords, default settings)

## 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 | `up_level` | Octave | 0 | 100 | 80 | % | linear |
| 1 | `dry_level` | Dry | 0 | 100 | 100 | % | linear |
| 2 | `character` | Character | 0 | 100 | 40 | % | linear |
| 3 | `focus_hz` | Focus | 100 | 3000 | 800 | Hz | log |
| 4 | `drive_db` | Drive | 0 | 30 | 6 | dB | linear |
| 5 | `tone_hz` | Tone | 500 | 16000 | 5000 | Hz | log |
| 6 | `gate_db` | Gate | -80 | -20 | -50 | dB | linear |
| 7 | `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.pitch.swoopline" };
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.pitch.swoopline", &e) == SOURND_OK) {
    sournd_engine_prepare(e, 48000.0, 512);
    sournd_engine_set_param(e, 0, 80); /* Octave */
    sournd_engine_process(e, in, out, 2, frames);
    sournd_engine_destroy(e);
}
```

## How it is made

Original sOURnd design blending general techniques: a focus low-pass, an all-pass Hilbert pair for the analytic signal and phase doubling, full-wave rectification with DC blocking, tanh drive, a 2:1 downward expander below a threshold and a two-pole tone filter. Character informed by our own measurements of rectifier-style octave-up circuits (period kept, tails gated, upper harmonics lifted).

## Ask your AI

Paste this into your coding assistant:

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