# Lucento

> 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.

- Engine id: `org.sournd.delay.lucento`
- Category: Delay
- 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: 60 s
- Sidechain input: no
- Channels: mono or stereo
- Audio demo: https://sournd.com/static/preview/demos/lucento.mp3 (plucked chords, default settings)
- Live preview: https://sournd.com/engines/lucento/ (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 | `time_ms` | Time | 1 | 4000 | 375 | ms | log |
| 1 | `sync` | Sync | 0 | 13 | 0 | - | linear |
| 2 | `feedback` | Feedback | 0 | 0.98 | 0.4 | - | linear |
| 3 | `low_cut_hz` | Low cut | 20 | 2000 | 40 | Hz | log |
| 4 | `high_cut_hz` | High cut | 1000 | 20000 | 12000 | Hz | log |
| 5 | `offset_ms` | Offset | 0 | 100 | 0 | ms | linear |
| 6 | `tempo` | Tempo | 40 | 300 | 120 | bpm | linear |
| 7 | `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.lucento" };
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.lucento", &e) == SOURND_OK) {
    sournd_engine_prepare(e, 48000.0, 512);
    sournd_engine_set_param(e, 0, 375); /* Time */
    sournd_engine_process(e, in, out, 2, frames);
    sournd_engine_destroy(e);
}
```

## How it is made

Original sOURnd design: a linear-interpolated delay line per channel read by a crossfading tap (equal-power switch between old and new read points on any time change), 12 dB/oct high-pass and low-pass inside the feedback loop, tempo-derived note times and a fixed right-channel offset.

## Ask your AI

Paste this into your coding assistant:

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