# Twindle

> Two delays side by side: left and right each get their own time (milliseconds or a synced note) and feedback. Cross sends each side's repeats into the other, from fully separate echoes to a ping-pong. Low and high cut shape every repeat. Sync: 0 = free, 1..13 = 1/32 to 1 bar.

- Engine id: `org.sournd.delay.twindle`
- Category: Delay
- 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: 60 s
- Sidechain input: no
- Channels: mono or stereo
- Audio demo: https://sournd.com/static/preview/demos/twindle.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 | `time_l_ms` | Left time | 1 | 4000 | 250 | ms | log |
| 1 | `sync_l` | Left sync | 0 | 13 | 0 | - | linear |
| 2 | `time_r_ms` | Right time | 1 | 4000 | 375 | ms | log |
| 3 | `sync_r` | Right sync | 0 | 13 | 0 | - | linear |
| 4 | `feedback_l` | Left feedback | 0 | 0.95 | 0.35 | - | linear |
| 5 | `feedback_r` | Right feedback | 0 | 0.95 | 0.35 | - | linear |
| 6 | `cross` | Cross | 0 | 1 | 0 | - | linear |
| 7 | `low_cut_hz` | Low cut | 20 | 2000 | 60 | Hz | log |
| 8 | `high_cut_hz` | High cut | 1000 | 20000 | 10000 | Hz | log |
| 9 | `tempo` | Tempo | 40 | 300 | 120 | bpm | linear |
| 10 | `mix` | Mix | 0 | 100 | 30 | % | 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.delay.twindle" };
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.delay.twindle", &e) == SOURND_OK) {
    sournd_engine_prepare(e, 48000.0, 512);
    sournd_engine_set_param(e, 0, 250); /* Left time */
    sournd_engine_process(e, in, out, 2, frames);
    sournd_engine_destroy(e);
}
```

## How it is made

Original sOURnd design: two crossfading-tap delay lines with a column-normalised feedback matrix (each side's feedback split between itself and the other by the cross control, so no column exceeds its own feedback), 12 dB/oct cuts in each loop and tempo-derived note times.

## Ask your AI

Paste this into your coding assistant:

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

## Related engines

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

- [Lucento](https://sournd.com/engines/lucento/index.md): Free. Clean digital echo: every repeat an exact copy, trimmed by low and high cut in the loop. Set the time in milliseconds or lock it to a note of the host tempo (the Tempo control stands in without one). Changing the time crossfades to the new echo instead of bending its pitch. Offset delays the right side for width. Sync: 0 = free, 1 = 1/32, 2 = 1/16T, 3 = 1/16, 4 = 1/16D, 5 = 1/8T, 6 = 1/8, 7 = 1/8D, 8 = 1/4T, 9 = 1/4, 10 = 1/4D, 11 = 1/2, 12 = 1/2D, 13 = 1 bar.
- [Driftel](https://sournd.com/engines/driftel/index.md): Free. Warm, wandering echo. Repeats bend in pitch, soften and saturate as they fade.
- [Backwash](https://sournd.com/engines/backwash/index.md): Paid. Backwards echo: every chunk of time is played back reversed during the next one, so notes swell in from nothing and cut off. Feedback flips the repeats back and forth. Fade sets how soft each chunk's edges are. Sync: 0 = free, 1..13 = 1/32 to 1 bar (chunks longer than 2 s are held at 2 s).
- [Bucketta](https://sournd.com/engines/bucketta/index.md): Paid. Dark, gritty analogue-style echo. Short times stay bright, long times get murky because the virtual clock slows down; a compander makes hiss and grit swell and fade with the playing; turning the time bends the repeats in pitch, and the glide sets how fast. Sync as the other echoes: 0 = free, 1..13 = 1/32 to 1 bar.
- [Graniel](https://sournd.com/engines/graniel/index.md): Paid. Granular echo: the delayed sound is cut into short grains, scattered in time by Spray, pitched and panned, and layered at the chosen density, from a shimmering cloud to a stuttering glitch. Feedback feeds the cloud back into itself; Freeze (on above half) stops recording so the grains keep playing the held sound. Sync: 0 = free, 1..13 = 1/32 to 1 bar.
- [Tapsody](https://sournd.com/engines/tapsody/index.md): Paid. Rhythmic multi-tap echoes that fan out across the stereo field, even, speeding up or slowing down.
- [Volleto](https://sournd.com/engines/volleto/index.md): Paid. Stereo ping-pong. Repeats bounce left and right, thinning and blurring into a wash as they go.
