rvsttd: 5ms fade-out on debug WAV to eliminate trailing click

This commit is contained in:
2026-08-17 06:47:46 +00:00
parent b6361ec080
commit b40a06b01b
+11 -1
View File
@@ -113,7 +113,17 @@ impl DebugRecorder {
self.audio.extend_from_slice(samples);
}
fn save(self) {
fn save(mut self) {
// Apply 5ms fade-out to the end to avoid click at the trailing edge
let fade_samples = (SAMPLE_RATE as usize * 5) / 1000; // 5ms
if self.audio.len() > fade_samples {
let start = self.audio.len() - fade_samples;
for i in 0..fade_samples {
let t = 1.0 - (i as f32 / fade_samples as f32);
self.audio[start + i] *= t;
}
}
// Write log
let log_path = self.dir.join("session.log");
match std::fs::File::create(&log_path) {