Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
The mix reaches its loudness: make-up gain is found by a secant over up to 8 passes, so a dense beat the leveller holds back lands on the target and not 2 LU under it (#220)
shinyobjectz8345d762233a
diff --git a/systems/mix/src/offline.rs b/systems/mix/src/offline.rsindex 11873adf..2fa1bdd2 100644--- a/systems/mix/src/offline.rs+++ b/systems/mix/src/offline.rs@@ -191,7 +191,7 @@ pub const MIX: (f64, f64) = (-14.0, -1.0);/// play's master-gain): with a <Mix> (`mix`: target LUFS, ceiling dBTP), the gain from the raw sound to the target, then/// the limiter at the ceiling, the ceiling lowered by any overshoot `encode` (an AAC round trip) puts back (twice at most);/// without one, MIX; the leveller (nodes::LEVEL) rounds the loud passages first, and the gain is made up for what it-/// took. Returns the master it used and the mastered sound.+/// took, each pass by what the last one's gain bought (#220). Returns the master it used and the mastered sound.pub fn master_mix(raw: &raea_io_media::Audio, mix: Option<(f64, f64)>, encode: Encode) -> (Option<(f64, f64)>, raea_io_media::Audio) {let out = mastered(raw, mix, encode);// its passes' copies of the whole sound, freed, handed back now (SG4a)@@ -206,13 +206,14 @@ fn mastered(raw: &raea_io_media::Audio, mix: Option<(f64, f64)>, encode: Encode)// a join the mix drops into dead silence gets the room's tone, found at the level the master plays it (joins.rs)let raw = &crate::joins::filled(raw, gain);let mut a = master_raw(raw, Some((gain, ceiling)));- // the leveller takes a little loudness with the peaks: made up, twice at most- for _ in 0..2 {+ let mut last: Option<(f64, f64)> = None;+ for _ in 0..8 {let got = raea_io_media::audio::lufs(&a);+ let slope = last.map(|(g0, l0)| ((got - l0) / (gain - g0)).clamp(0.05, 1.0)).filter(|s| s.is_finite()).unwrap_or(1.0);if !got.is_finite() || (got - lufs).abs() <= 0.2 {break;}- gain += lufs - got;+ (last, gain) = (Some((gain, got)), gain + ((lufs - got) / slope).clamp(-12.0, 12.0));a = master_raw(raw, Some((gain, ceiling)));}let mut master = Some((gain, ceiling));