feat: add Anvil sub anchor and Crucible resampler
Check and Windows preview / check (anvil) (push) Successful in 2m41s
Check and Windows preview / check (crucible) (push) Successful in 2m7s
Check and Windows preview / check (patina) (push) Successful in 2m5s
Check and Windows preview / check (rivet) (push) Successful in 1m33s
Check and Windows preview / previews (push) Successful in 1m10s
Check and Windows preview / windows (push) Successful in 2m2s
Independent plugin release / publish (push) Successful in 8s
Independent plugin release / plan (push) Successful in 7s
Independent plugin release / build (push) Successful in 3m3s
Check and Windows preview / check (anvil) (push) Successful in 2m41s
Check and Windows preview / check (crucible) (push) Successful in 2m7s
Check and Windows preview / check (patina) (push) Successful in 2m5s
Check and Windows preview / check (rivet) (push) Successful in 1m33s
Check and Windows preview / previews (push) Successful in 1m10s
Check and Windows preview / windows (push) Successful in 2m2s
Independent plugin release / publish (push) Successful in 8s
Independent plugin release / plan (push) Successful in 7s
Independent plugin release / build (push) Successful in 3m3s
Two new CLAP effects aimed at riddim and dubstep production, plus shared crates so all four plugins keep one look and reuse DSP. Anvil 0.1.0 (io.storyboard.sub-anchor): - Replaces the band below Split with a clean mono sine. Every note gets the same peak level and restarts at the same phase, so switch-ups keep their weight and kick hits line up. - Pitch and note starts come from the audio (YIN, 80 ms lookahead reported to the host) or from MIDI notes sent to the effect. - Dynamics, Drive, Octave, Glide, Phase, Gate and Keep; Solo sub monitor, note readout, level meters and a low-band oscilloscope. Crucible 0.1.0 (io.storyboard.resampler): - Records its input continuously in a lock-free ring with host transport markers. Capture takes the newest 1-16 complete bars on the bar grid, following tempo changes, or the newest audio when stopped. - Grid (straight and triplet) or transient slicing, manual cuts, slice audition without audio-thread allocation. - Export writes the loop, trimmed, declicked and normalised slices named and tagged with their root note, and an optional 2048-sample wavetable for Serum and Vital. Shared: - common-ui holds the palette, fonts, knobs and panels taken from Patina; Patina renders identically. Rotary knobs at their minimum no longer tessellate a zero-length arc into NaN vertices. - common-dsp holds biquads, a Linkwitz-Riley crossover, YIN, note helpers and a float WAV writer with sampler root and Serum frame chunks. - Catalog, CI matrix, release tags, editor previews and docs cover both plugins; a script test keeps the catalog and workflows in step.
This commit is contained in:
1 parent
f1366280ff
commit
f36ff0780c
57 files changed
+10373
-285
No files matched your search
@@ -0,0 +1,350 @@
|
||||
//! Anvil editor, shared by the CLAP wrapper and the headless renderer.
|
||||
use anvil_core::{AnalyzerFrame, Settings, Source, SCOPE};
|
||||
use common_ui::*;
|
||||
use egui::{self, Color32, FontId, Pos2, RichText, Sense, Stroke, Vec2};
|
||||
|
||||
pub use common_ui::style;
|
||||
pub const WIDTH: u32 = 980;
|
||||
pub const HEIGHT: u32 = 704;
|
||||
|
||||
pub struct State {
|
||||
pub solo: bool,
|
||||
pub analyzer: AnalyzerFrame,
|
||||
/// True while a pointer button is held, so knob drags become one host gesture.
|
||||
pub gesture_active: bool,
|
||||
pub help: String,
|
||||
}
|
||||
impl Default for State {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
solo: false,
|
||||
analyzer: AnalyzerFrame::default(),
|
||||
gesture_active: false,
|
||||
help: DEFAULT_HELP.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
const DEFAULT_HELP: &str =
|
||||
"Put Anvil on the bass, set Split just above the sub, then set Sub level once for every patch.";
|
||||
impl State {
|
||||
pub fn accept_frame(&mut self, frame: AnalyzerFrame) {
|
||||
let old = self.analyzer;
|
||||
self.analyzer = frame;
|
||||
// Meters fall smoothly; the readout and scope stay exact.
|
||||
self.analyzer.low_db = frame.low_db.max(old.low_db - 1.5);
|
||||
self.analyzer.sub_db = frame.sub_db.max(old.sub_db - 1.5);
|
||||
}
|
||||
}
|
||||
fn hint(r: &egui::Response, state: &mut State, text: &str) {
|
||||
if r.hovered() || r.has_focus() {
|
||||
state.help = text.into();
|
||||
}
|
||||
}
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn knob(
|
||||
ui: &mut egui::Ui,
|
||||
state: &mut State,
|
||||
name: &str,
|
||||
value: &mut f32,
|
||||
range: std::ops::RangeInclusive<f32>,
|
||||
default: f32,
|
||||
unit: &str,
|
||||
size: f32,
|
||||
help: &str,
|
||||
) {
|
||||
ui.vertical_centered(|ui| {
|
||||
let r = rotary(ui, name, value, range, default, unit, size, ACCENT);
|
||||
hint(&r, state, help);
|
||||
});
|
||||
}
|
||||
fn toggle(ui: &mut egui::Ui, state: &mut State, on: &mut bool, label: &str, help: &str) {
|
||||
let r = ui.selectable_label(*on, RichText::new(label).size(13.));
|
||||
if r.clicked() {
|
||||
*on = !*on;
|
||||
}
|
||||
hint(&r, state, help);
|
||||
}
|
||||
fn scope(ui: &mut egui::Ui, frame: &AnalyzerFrame, height: f32) {
|
||||
let (rect, _) = ui.allocate_exact_size(Vec2::new(ui.available_width(), height), Sense::hover());
|
||||
let p = ui.painter_at(rect);
|
||||
p.rect_filled(rect, 2., SCREEN);
|
||||
let mid = rect.center().y;
|
||||
for k in 1..6 {
|
||||
let x = rect.left() + rect.width() * k as f32 / 6.;
|
||||
p.line_segment(
|
||||
[Pos2::new(x, rect.top()), Pos2::new(x, rect.bottom())],
|
||||
Stroke::new(1.0_f32, Color32::from_rgb(24, 26, 30)),
|
||||
);
|
||||
}
|
||||
p.line_segment(
|
||||
[Pos2::new(rect.left(), mid), Pos2::new(rect.right(), mid)],
|
||||
Stroke::new(1.0_f32, EDGE),
|
||||
);
|
||||
let peak = frame
|
||||
.scope_low
|
||||
.iter()
|
||||
.chain(frame.scope_sub.iter())
|
||||
.fold(0.05f32, |m, v| m.max(v.abs()));
|
||||
let scale = rect.height() * 0.42 / peak;
|
||||
for (data, color, width) in [
|
||||
(&frame.scope_low, STEEL, 1.5_f32),
|
||||
(&frame.scope_sub, ACCENT, 2.0_f32),
|
||||
] {
|
||||
let points: Vec<Pos2> = data
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, v)| {
|
||||
Pos2::new(
|
||||
rect.left() + rect.width() * i as f32 / (SCOPE - 1) as f32,
|
||||
mid - v * scale,
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
p.add(egui::Shape::line(points, Stroke::new(width, color)));
|
||||
}
|
||||
p.text(
|
||||
rect.left_top() + Vec2::new(10., 8.),
|
||||
egui::Align2::LEFT_TOP,
|
||||
"ORIGINAL LOW BAND",
|
||||
FontId::proportional(11.),
|
||||
STEEL,
|
||||
);
|
||||
p.text(
|
||||
rect.left_top() + Vec2::new(130., 8.),
|
||||
egui::Align2::LEFT_TOP,
|
||||
"NEW SUB",
|
||||
FontId::proportional(11.),
|
||||
ACCENT,
|
||||
);
|
||||
p.text(
|
||||
rect.right_top() + Vec2::new(-10., 8.),
|
||||
egui::Align2::RIGHT_TOP,
|
||||
format!("{:.0} ms", frame.scope_ms),
|
||||
FontId::proportional(11.),
|
||||
MUTED,
|
||||
);
|
||||
p.rect_stroke(
|
||||
rect,
|
||||
2.,
|
||||
Stroke::new(1.0_f32, EDGE),
|
||||
egui::StrokeKind::Inside,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn show(ui: &mut egui::Ui, settings: &mut Settings, state: &mut State) {
|
||||
backdrop(ui);
|
||||
state.help = DEFAULT_HELP.into();
|
||||
state.gesture_active = ui.input(|i| i.pointer.any_down());
|
||||
ui.add_space(2.);
|
||||
header(ui, "ANVIL", "SUB ANCHOR", |ui| {
|
||||
let r = ui
|
||||
.selectable_label(settings.bypass, RichText::new("BYPASS").size(13.))
|
||||
.on_hover_text("Crossfade to the delayed dry signal.");
|
||||
if r.clicked() {
|
||||
settings.bypass = !settings.bypass;
|
||||
}
|
||||
let r = ui
|
||||
.selectable_label(state.solo, RichText::new("SOLO SUB").size(13.))
|
||||
.on_hover_text("Hear only the generated sub.");
|
||||
if r.clicked() {
|
||||
state.solo = !state.solo;
|
||||
}
|
||||
ui.separator();
|
||||
for (source, label) in [(Source::Midi, "MIDI"), (Source::Audio, "AUDIO")] {
|
||||
let r = ui.selectable_label(settings.source == source, RichText::new(label).size(13.));
|
||||
if r.clicked() {
|
||||
settings.source = source;
|
||||
}
|
||||
}
|
||||
caption(ui, "PITCH FROM");
|
||||
});
|
||||
ui.add_space(6.);
|
||||
let frame = state.analyzer;
|
||||
ui.horizontal_top(|ui| {
|
||||
panel(ui, |ui| {
|
||||
ui.set_width(260.);
|
||||
ui.set_min_height(TOP);
|
||||
ui.vertical(|ui| note_panel(ui, settings, &frame));
|
||||
});
|
||||
ui.add_space(4.);
|
||||
panel(ui, |ui| {
|
||||
ui.set_width(ui.available_width());
|
||||
scope(ui, &frame, TOP);
|
||||
});
|
||||
});
|
||||
ui.add_space(6.);
|
||||
panel(ui, |ui| {
|
||||
ui.set_width(ui.available_width());
|
||||
ui.vertical(|ui| controls(ui, settings, state));
|
||||
});
|
||||
ui.separator();
|
||||
ui.label(RichText::new(&state.help).color(MUTED));
|
||||
}
|
||||
const TOP: f32 = 196.;
|
||||
fn note_panel(ui: &mut egui::Ui, settings: &Settings, frame: &AnalyzerFrame) {
|
||||
caption(ui, "NOTE");
|
||||
let (name, hz) = match frame.note {
|
||||
Some(n) if frame.hz > 0. => (common_dsp::note_name(n), format!("{:.1} Hz", frame.hz)),
|
||||
_ => ("—".into(), "no note".into()),
|
||||
};
|
||||
ui.label(
|
||||
RichText::new(name)
|
||||
.font(FontId::new(54., egui::FontFamily::Name("medium".into())))
|
||||
.color(if frame.note.is_some() { TEXT } else { DIM }),
|
||||
);
|
||||
ui.label(RichText::new(hz).monospace().size(14.).color(MUTED));
|
||||
ui.add_space(10.);
|
||||
meter(ui, "ORIGINAL", frame.low_db, STEEL, 100.);
|
||||
meter(ui, "NEW SUB", frame.sub_db, ACCENT, 100.);
|
||||
ui.add_space(10.);
|
||||
ui.label(
|
||||
RichText::new(format!(
|
||||
"{:.0} ms lookahead · {}",
|
||||
frame.latency as f32 / frame.sample_rate * 1000.,
|
||||
match settings.source {
|
||||
Source::Audio => "detecting pitch",
|
||||
Source::Midi => "following MIDI notes",
|
||||
}
|
||||
))
|
||||
.size(12.)
|
||||
.color(MUTED),
|
||||
);
|
||||
}
|
||||
fn controls(ui: &mut egui::Ui, settings: &mut Settings, state: &mut State) {
|
||||
let defaults = Settings::default();
|
||||
ui.columns(4, |c| {
|
||||
knob(
|
||||
&mut c[0],
|
||||
state,
|
||||
"Sub level",
|
||||
&mut settings.level,
|
||||
-30. ..=0.,
|
||||
defaults.level,
|
||||
" dBFS",
|
||||
88.,
|
||||
"Peak level of the new sub. Every note gets exactly this level.",
|
||||
);
|
||||
knob(
|
||||
&mut c[1],
|
||||
state,
|
||||
"Split",
|
||||
&mut settings.split,
|
||||
40. ..=200.,
|
||||
defaults.split,
|
||||
" Hz",
|
||||
88.,
|
||||
"Below this frequency the original sub is replaced.",
|
||||
);
|
||||
knob(
|
||||
&mut c[2],
|
||||
state,
|
||||
"Dynamics",
|
||||
&mut settings.dynamics,
|
||||
0. ..=100.,
|
||||
defaults.dynamics,
|
||||
" %",
|
||||
88.,
|
||||
"0 %: constant level per note. Higher: follow the original's wobble shape.",
|
||||
);
|
||||
knob(
|
||||
&mut c[3],
|
||||
state,
|
||||
"Drive",
|
||||
&mut settings.drive,
|
||||
0. ..=100.,
|
||||
defaults.drive,
|
||||
" %",
|
||||
88.,
|
||||
"Adds upper harmonics so the sub reads on small speakers.",
|
||||
);
|
||||
});
|
||||
ui.add_space(6.);
|
||||
ui.separator();
|
||||
ui.columns(6, |c| {
|
||||
let mut octave = settings.octave as f32;
|
||||
knob(
|
||||
&mut c[0],
|
||||
state,
|
||||
"Octave",
|
||||
&mut octave,
|
||||
-2. ..=1.,
|
||||
0.,
|
||||
"",
|
||||
54.,
|
||||
"Shift the sub against the detected note. −1 for basses played high.",
|
||||
);
|
||||
settings.octave = octave.round() as i32;
|
||||
knob(
|
||||
&mut c[1],
|
||||
state,
|
||||
"Glide",
|
||||
&mut settings.glide,
|
||||
0. ..=200.,
|
||||
defaults.glide,
|
||||
" ms",
|
||||
54.,
|
||||
"Slide time when notes overlap. 0 jumps.",
|
||||
);
|
||||
knob(
|
||||
&mut c[2],
|
||||
state,
|
||||
"Phase",
|
||||
&mut settings.phase,
|
||||
0. ..=360.,
|
||||
defaults.phase,
|
||||
"°",
|
||||
54.,
|
||||
"Start phase of every note. Line it up with your kick.",
|
||||
);
|
||||
knob(
|
||||
&mut c[3],
|
||||
state,
|
||||
"Gate",
|
||||
&mut settings.gate,
|
||||
-60. ..=-20.,
|
||||
defaults.gate,
|
||||
" dB",
|
||||
54.,
|
||||
"Input level that counts as a note. Raise it if tails retrigger.",
|
||||
);
|
||||
knob(
|
||||
&mut c[4],
|
||||
state,
|
||||
"Keep",
|
||||
&mut settings.keep,
|
||||
0. ..=100.,
|
||||
defaults.keep,
|
||||
" %",
|
||||
54.,
|
||||
"Blend some original low band back under the new sub.",
|
||||
);
|
||||
knob(
|
||||
&mut c[5],
|
||||
state,
|
||||
"Output",
|
||||
&mut settings.output,
|
||||
-12. ..=12.,
|
||||
defaults.output,
|
||||
" dB",
|
||||
54.,
|
||||
"Output trim.",
|
||||
);
|
||||
});
|
||||
ui.add_space(4.);
|
||||
ui.horizontal(|ui| {
|
||||
toggle(
|
||||
ui,
|
||||
state,
|
||||
&mut settings.retrigger,
|
||||
"RETRIGGER",
|
||||
"Restart the sine at Phase on every note, so each note and kick hit lines up.",
|
||||
);
|
||||
toggle(
|
||||
ui,
|
||||
state,
|
||||
&mut settings.snap,
|
||||
"SNAP TO SEMITONE",
|
||||
"Round the detected pitch. Turn off for slides and pitch bends.",
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user