Repository navigation
Fix interpolated delay reads at short delays (gen~ and LibSource) - #138
Merged
Merged
Conversation
The interpolated reads take p points from the delay position upwards; Max 9 limits the delay to 1 (+1 for read before write) for all of them, so short delays read the oldest samples in memory: on a ramp ending at 199, cubic returned 202.5 at d=2.5 and spline6 150 at d<=3. The lowest delay is now 2 (+1) for the 4-point reads and 4 (+1) for spline6; shorter delays are clipped, as for the other reads. Longer delays and the d-1 / d-2 offsets of these reads are unchanged.
The CUBIC_4P, CUBIC_4P_SMOOTH and HERMITE readers take idx-1..idx+2, so delay(in, out, ...) with a readDelay under one sample read the slot after the last write, the oldest sample in the buffer: +8.66 instead of -0.25 on a ramp for CUBIC_4P at 0.25. delay(in, out, ...) now clips readDelay (and the begin/end delays of the ramped version) to min_delay, 1 for these methods and 0 for the others; FractionalDelayProcessor uses it. E.g. a flanger sweeping down to zero delay no longer glitches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Interpolated delay reads could read past the last written sample at short delays, picking up the oldest sample in the buffer. Fixed in gen~ (genlib) and in LibSource. Follows #137.
gen~ Delay (GenSource/genlib_ops.h)
The interpolated reads take p points from the delay position upwards. Max 9 limits the delay to 1 sample (+1 for read before write) for all of them, so at short delays the newest points wrap to the oldest samples: on a ramp ending at 199,
read_cubicreturned 202.5 at d=2.5 andread_spline6150 at d<=3.read_cubic,read_fastcubic,read_spline: lowest delay 2 (+1)read_spline6: lowest delay 4 (+1)LibSource InterpolatingCircularFloatBuffer
The CUBIC_4P, CUBIC_4P_SMOOTH and HERMITE readers take idx-1..idx+2, so
delay(in, out, ...)with a readDelay under one sample read the slot after the last write: +8.66 instead of -0.25 on a ramp for CUBIC_4P at 0.25, e.g. a flanger sweeping down to zero delay would glitch at the bottom of the sweep.delay(in, out, ...)and the ramped version clip readDelay (begin/end) tomin_delay: 1 for the 4-point methods, 0 for the others.FractionalDelayProcessoruses thesedelay(out, len, delay)is unchanged: its delay is relative to wherever the caller last wroteTests
GenOpsTest: short-delay reads of a ramp, clipped to the new limits (47 failures with Max 9's limits)InterpolatingCircularBufferTest: ramp throughdelay(in, out, ...)at 0-1.5 samples for linear, cubic 3p, cubic 4p, cubic 4p smooth and Hermite (192 failures without the fix)Verification
make checkpasses (all unit tests; ARM, web + webtest and native for each test patch)