# Followtone

> Track oscillator: a synth voice that follows the pitch and dynamics of what you play or sing, up or down octaves, with glide and a tone control, blended under the dry sound for synth-bass, organ-like doubling or pure-tone tracking.

- Engine id: `org.sournd.pitch.followtone`
- Category: Pitch
- Licence: paid: £2.99 an effect or £4.99 a synth, once (owned for good, with updates), or included in the Everything plan (£14.99 a month)
- Version: 1.0.0
- Latency: 0 samples
- Tail: 3 s
- Sidechain input: no
- Channels: mono or stereo
- Audio demo: https://sournd.com/static/preview/demos/followtone.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 | `wave` | Wave | 0 | 3 | 1 | - | linear |
| 1 | `octave` | Octave | -3 | 2 | 0 | oct | linear |
| 2 | `fine_cents` | Fine | -100 | 100 | 0 | cents | linear |
| 3 | `glide_ms` | Glide | 0 | 500 | 20 | ms | linear |
| 4 | `fm_amount` | FM amount | 0 | 100 | 30 | % | linear |
| 5 | `sensitivity` | Sensitivity | 0 | 100 | 50 | % | linear |
| 6 | `follow` | Follow | 0 | 100 | 100 | % | linear |
| 7 | `attack_ms` | Attack | 0.5 | 100 | 5 | ms | log |
| 8 | `release_ms` | Release | 10 | 2000 | 150 | ms | log |
| 9 | `tone_hz` | Tone | 200 | 20000 | 8000 | Hz | log |
| 10 | `mix` | Mix | 0 | 100 | 50 | % | linear |
| 11 | `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.followtone" };
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.followtone", &e) == SOURND_OK) {
    sournd_engine_prepare(e, 48000.0, 512);
    sournd_engine_set_param(e, 0, 1); /* Wave */
    sournd_engine_process(e, in, out, 2, frames);
    sournd_engine_destroy(e);
}
```

## How it is made

Original sOURnd design blending general techniques: an autocorrelation (difference-function) pitch tracker driving band-limited oscillators (sine, poly-BLEP saw and square, self-modulated sine) with log-frequency glide, envelope-follower or gated level, and a one-pole tone filter.

## Ask your AI

Paste this into your coding assistant:

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

## Related engines

Other [pitch engines](https://sournd.com/engines/category/pitch/index.md):

- [Octunder](https://sournd.com/engines/octunder/index.md): Free. Analogue-style sub octaves: square-wave subs one and two octaves down that answer instantly and follow your dynamics, rounded by a tone control. Single notes only, like the circuits it is modelled on in spirit.
- [Swoopline](https://sournd.com/engines/swoopline/index.md): Free. 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.
- [Downstep](https://sournd.com/engines/downstep/index.md): Paid. Drop tuning without retuning: chords and single notes move down (or up) as one, fully wet by default, body resonances left where they were and the low end filled back in so it sounds like a lower-tuned instrument rather than a pitch shifter.
- [Northnote](https://sournd.com/engines/northnote/index.md): Paid. Pitch correction for voices and single-note lines: pulls every note to the nearest note of your key and scale (chromatic, major, minor, pentatonics or your own 12-note set) at a speed from natural to a hard snap at 0 ms, with humanise to leave held notes and vibrato alone.
- [Octrel](https://sournd.com/engines/octrel/index.md): Paid. Clean polyphonic octaves: a sub, a second sub and an octave up that follow chords, with their own levels, a darkening filter for the subs and a squash that keeps the octave voices even.
- [Tessarine](https://sournd.com/engines/tessarine/index.md): Paid. The everything pitch engine: four voices from three octaves down to three up with fine tune, level, pan and delay each; chord-friendly or single-note mode, formants kept or moved, detune spread and a feedback path that climbs in cascades.
