Skip to content

Commit 86071a2

Browse files
committed
hopefully fixed phase discontinuity issue in delay_line
1 parent 0b14160 commit 86071a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/firewheel-core/src/dsp/delay_line.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ impl DelayLine {
7575
}
7676

7777
// Find the two indices to interpolate between
78-
let index_a = index_f.floor() as usize % buffer_len;
78+
let mut index_a = index_f.floor() as usize;
79+
// Account for rounding errors
80+
if index_a == buffer_len {
81+
index_a -= 1;
82+
}
7983
let index_b = (index_a + 1) % buffer_len;
8084

8185
let sample_a = self.buffer[index_a];

0 commit comments

Comments
 (0)