rvsttd: 5ms fade-out on debug WAV to eliminate trailing click
This commit is contained in:
+11
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user