Files
bass-foundry/docs/patina/README.md
T
nvrl 17c6fe3ab9
Check and Windows preview / check (patina) (push) Successful in 1m48s
Check and Windows preview / check (rivet) (push) Successful in 1m26s
Check and Windows preview / previews (push) Successful in 55s
Independent plugin release / plan (push) Successful in 7s
Check and Windows preview / windows (push) Successful in 1m41s
Independent plugin release / build (push) Successful in 2m28s
Independent plugin release / publish (push) Successful in 7s
feat(patina): rebuild resonance detector, simplify controls, new look
Patina 0.2.0. The old detector compared raw FFT bins with a one-octave
dB mean, so every harmonic of a tonal sound looked like a resonance and
real harsh bumps were barely touched. The new detector:

- averages power over each log band and smooths it over time
- joins harmonic tops into an envelope, smoothed by Sharpness
- compares it with a robust, tilt-aware local line fit that ignores
  empty regions and cannot be lifted by the bump itself

Six overlapping controls become Depth, Sharpness and Selectivity; focus
points now read "up cuts more, down protects". The analysis window is
halved to 2048 samples (about 43 ms delay). Behaviour tests cover plain
harmonic tones, resonant bumps, narrow rings, level independence,
flicker on noise and high sample rates.

Both editors get a dark metallic look with #FF0160 as the single
accent colour; screenshots and docs are updated. Projects saved with
Patina 0.1 load the new controls at their defaults.
2026-11-06 01:38:17 +01:00

129 lines
6.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Patina
Patina smooths a sound’s rough surface without erasing its character. Formerly
**Resonance Compressor**; current version **0.2.0**.
A mixing effect that finds harsh, ringing regions as they happen and pulls them
down, while plain harmonic tone passes. Independently designed in Rust; no claim
of matching Soothe or Quance.
![Patina](assets/editor.png)
## Install on Windows
Download the Windows artifact from the Gitea plugin's Gitea release, or the branch pipeline's **windows** job and
extract the ZIP. Copy `Patina.clap` into
`C:\Program Files\Common Files\CLAP\`. In FL Studio 2024.1 or newer, open
Options → Manage plugins, enable Verify plugins, and Find installed plugins.
Load Patina in a mixer effect slot. Keep the font license with
redistributed packages.
## Work with it
Three controls decide what happens:
- **Depth** is the largest cut, in dB. 0 dB does nothing.
- **Sharpness** sets what counts as a resonance. Low values follow broad,
smooth bumps (honk, boxiness). High values target narrow rings and whistles.
- **Selectivity** sets how far a bump must stand out before it is cut. Low
values treat any bump; high values treat only the worst.
Start with Depth around 6 dB. Raise Selectivity until only the harsh parts show
cuts, then use Delta to hear what is removed. Restrict Low/High frequency to keep
the source’s body out of reach. Attack and Release set how quickly cuts grow and
recover; Transient guard briefly relaxes cuts on attacks to keep punch.
Double-click the plot to add one of four focus points. Drag a point up to cut
more in that region, down to protect it. Wheel changes its width. Range handles
on the plot drag the processing limits.
On the plot, the grey fill is the measured input. The bright line is what the
detector hears (its smoothed spectral envelope); the dim line is what it expects
there. Accent-coloured cuts appear where the bright line rises above the dim one
by more than Selectivity allows. The blue curve is the focus/protect shape.
Delta plays delayed dry minus wet before output trim. Use it to inspect changes,
then return to normal monitoring to decide whether the music improved.
Mix is a linear blend of aligned signals. Bypass keeps the same latency.
Use Output for matched-level comparison. Spectral attenuation is not a limiter:
sample peaks can increase even when frequency gains never exceed unity.
Four presets and A/B comparison help explore alternatives. Host parameters and
window size persist; Delta does not.
## How detection works
1. Each analysis frame is grouped into 512 log-spaced bands. Each band holds the
mean power of the FFT bins it covers, smoothed over time (about 5 ms rise,
40 ms fall) so cuts hold on a stable ring instead of flickering.
2. Neighbouring peaks are joined in dB, so the gaps between harmonics do not count
as the expected level. A plain harmonic tone reads as a smooth envelope.
3. The envelope is smoothed across frequency by the Sharpness width.
4. The reference is a robust local straight-line fit over 2–3 octaves: spectral
tilt is expected, bumps cannot raise their own reference, and empty regions
(below a fundamental, beyond a filter cutoff) are ignored.
5. Envelope minus reference, above the Selectivity threshold, becomes the cut,
limited by Depth, smoothed with Attack/Release, and linked across stereo.
## Timing and limits
Mixing only: 2048-sample analysis windows at 44.1/48 kHz, 4096 at 88.2/96 kHz,
8192 at 176.4/192 kHz, with eight overlaps. Delay is one window, about 43–46 ms.
The plugin reports it for host compensation. Supported layouts are mono and
linked stereo; supported rates are those six standard rates.
The engine uses complex RustFFT with supplied scratch buffers, WOLA reconstruction,
the envelope/reference detector above, bounded soft-knee cuts, and temporal
smoothing. Original bin phases are retained. This is not a minimum-phase filter
bank, a live monitoring effect, a limiter, or an automatic separation of tone and
unwanted resonance. No external sidechain, Learn, M/S, or pitch detector in v0.1.
## Build and offline evaluation
```sh
cargo test --workspace --locked
cargo run --release -p patina-render -- input.wav processed.wav
cargo run --release -p patina-render -- input.wav delta.wav --delta
cargo run --release -p patina-render -- --demo /tmp/patina-demo.wav
cargo run --release -p patina-render -- --benchmark
python scripts/build-plugin.py --plugin patina --target x86_64-pc-windows-gnu
```
The renderer accepts mono/stereo PCM16/24/32 and float32 RIFF/WAVE, capped at
256 MiB; WAV extensible/RF64 are not accepted. It writes float32 WAV, compensates
the processing delay, retains original duration, and refuses existing output.
An optional settings JSON uses the core's Settings structure.
## CI and acceptance
Gitea Actions cross-builds Windows binaries with MinGW on a Docker-capable
runner labelled `ubuntu-latest`. Branch/PR workflows build a combined preview
bundle; `patina-v<version>` tags check, build, and publish Patina independently.
See [release workflow](../releases.md) for runner setup and release attachments.
Actual runner execution remains to be verified on the Gitea instance.
Before calling host support complete, test FL Studio discovery as an effect,
automation, plugin delay compensation, parallel dry/wet alignment, repeated loading,
project restoration, mono/stereo, all supported sample rates, and render tails.
Judge through real patches with matched listening levels: preserve vowel motion,
snare punch, bass body, and stereo placement. Synthetic tests do not establish
artistic usefulness.
Local benchmark, optimized build, stereo 48 kHz, FFT 2048/hop 256: five seconds
processed in about 0.35–0.45 seconds (7–9% of one core on a laptop CPU). This is
not a worst-case multi-instance guarantee.
## Existing projects and source layout
The CLAP ID `io.storyboard.resonance-compressor` is unchanged. Version 0.2
replaces Amount, Sensitivity, Max cut, Neighborhood, Cut width, and Knee with
Depth, Sharpness, and Selectivity, so projects saved with 0.1 load those
controls at their defaults. Replace the former plugin file with `Patina.clap` and
rescan; avoid two scanned copies with the same ID. Host project recall still
needs verification in FL Studio.
Source is grouped into `plugins/patina/{core,ui,render,plugin}`. See
[research](research.md), [development](../development.md), and the
[independent release workflow](../releases.md).