Print the limiter through the bake's master stage, compensating its lookahead so an engaged bake is the approved sound and a bypassed one is unchanged

This commit is contained in:
2026-08-02 20:57:29 -04:00
parent a9c166b8c2
commit 0d316b7b9e
9 changed files with 232 additions and 75 deletions
+6 -3
View File
@@ -26,6 +26,9 @@ constexpr int kRate = 48000;
constexpr double kBpm = 120.0; // a quarter note is 0.5 s == 24000 frames
constexpr double kUnity = 1.0;
constexpr double kSilence = 1e-6;
// The derived window is a property of the voice chain, not of the master stage: every
// measurement here reads the render with the limiter bypassed.
constexpr bool kNoLimiter = false;
// The declick pad every derived window carries. Read off the engine's own constants, so a
// retuned ramp moves this file's expectations with it rather than against them.
@@ -97,7 +100,7 @@ BakeAudio bakeWith(const SampleData& s, double extraMs, Division hold = oneBar()
int velocity = 100) {
const std::optional<BakePlan> plan = planOf(derivedProgram(s, extraMs, hold, velocity));
if (!plan) { std::printf("FAIL: fixture window refused\n"); ++g_fail; return BakeAudio{}; }
return renderBake(s, *plan, kUnity);
return renderBake(s, *plan, kUnity, kNoLimiter);
}
std::int64_t derivedFrames(const SampleData& s, Division hold = oneBar()) {
@@ -116,7 +119,7 @@ std::int64_t freeRunningEnd(const SampleData& s, double heldSeconds) {
p.end = EndOffset(offsetFromMs(200.0));
const std::optional<BakePlan> plan = planOf(p);
if (!plan) { std::printf("FAIL: fixture reference window refused\n"); ++g_fail; return -1; }
return lastSoundingFrame(renderBake(s, *plan, kUnity));
return lastSoundingFrame(renderBake(s, *plan, kUnity, kNoLimiter));
}
// The last frame of the file, which is where a hard cut shows up.
@@ -190,7 +193,7 @@ int main() {
CHECK(plan.has_value());
if (plan) {
CHECK(plan->totalFrames == kFrames + kPad);
const BakeAudio whole = renderBake(s, *plan, kUnity);
const BakeAudio whole = renderBake(s, *plan, kUnity, kNoLimiter);
// Full level across the two seconds the saturated rung used to cut, and the file
// still ends on the declick ramp rather than on a hard edge.
CHECK(peakAt(whole, kSlowRate * 48, kFrames) > 0.4);