fix(dock): TRAX ladder gets the mic's ballistics (and a 33 Hz beat)
Reported: the TRAX bar moves, but its sampling looks far slower than the mic meter. Cause: the TRAX number was a raw instantaneous peak per metering block — a stutter sampled by the UI timer, with no smoothing. The mic looks fluid because it is smoothed at audio-callback rate. Fix: the player now smooths its measured level with the SAME curve the mic uses (MeterScale.NextLevel: fast attack, gentle decay), and the dock's meter clock runs at ~30 Hz instead of 20. Two ladders that move alike, because they are the same ballistics. Guard: MeterScaleTests pins the attack/decay behaviour alongside peak-hold.
This commit is contained in:
@@ -34,6 +34,15 @@ public static class MeterScale
|
||||
: dbfs >= CautionDb ? MeterBand.Caution
|
||||
: MeterBand.Nominal;
|
||||
|
||||
/// <summary>Ballistics for a level: reach a new peak quickly, fall back gently. Raw per-block
|
||||
/// peaks sampled by a UI timer look like a stutter; this is what makes the mic feel fluid, and
|
||||
/// TRAX gets the same curve so the two ladders move alike.</summary>
|
||||
public static float NextLevel(float current, float incoming, float attack = 0.6f, float decay = 0.12f)
|
||||
{
|
||||
var alpha = incoming > current ? attack : decay;
|
||||
return current + (incoming - current) * alpha;
|
||||
}
|
||||
|
||||
/// <summary>Peak hold: jumps up instantly to a new maximum and falls back at
|
||||
/// <paramref name="decayPerSecond"/> — a moment-to-moment bar hides clipping, which is the one
|
||||
/// audio fault that cannot be fixed afterwards.</summary>
|
||||
|
||||
Reference in New Issue
Block a user