RS-MET icon indicating copy to clipboard operation
RS-MET copied to clipboard

How do you know when delay is finished?

Open elanhickler opened this issue 7 years ago • 10 comments

Need to bypass FX... well more specifically, the oscilloscope takes 1.6% cpu idle (in debug mode, but still...). Is there a way to tell when the ping pong delay's buffer is basically silent/empty, maybe below 1.e-6 amplitude?

elanhickler avatar Jan 23 '18 04:01 elanhickler

also, how do you get rid of this: image

elanhickler avatar Jan 23 '18 04:01 elanhickler

strictly speaking, it will have finished only when the signal falls soo low that it will be flushed to zero (by our denormal flush-to-zero code) - which can take a really long time. for practical matters, i'd probably use a threshold of something like -100dB - but obviously, the choice of that number is a matter of judgement. 1.e-6 - one part in a million - i think that's -60 dB - it's a value typically used to define reverb time (RT60 is a common measure for the length of f reverb tail). . soo - yeah - pick something in that ballpark

RobinSchmidt avatar Jan 23 '18 07:01 RobinSchmidt

oh - these pixel values is in ColourSchemeComponent.cpp - you must set a boolean value to false in paintOverChildren. i use that in debug mode to figure out optimal editor sizes (there are certain values for which the grid lines look homogenous, for example - see comment in the constructor of EngineersFilterEditor)

RobinSchmidt avatar Jan 23 '18 07:01 RobinSchmidt

unfortunately, when the grid-lines look homogenous, they are two pixels wide (and have half the brightness). maybe i should offset all pixel coordinates by 0.5. must be something about what you consider the pixel coodinates to be - top-left or center of the pixel - and my drawing code makes a wrong assumption of the convention used by juce

RobinSchmidt avatar Jan 23 '18 07:01 RobinSchmidt

...i think, the rule is: if there are N grid-lines, your pixel-width (or height) of the plot should be divisible by N+1 (because there are N+1 sections...or something...just some gut math and trial and error, i didn't consult pencil and paper)

RobinSchmidt avatar Jan 23 '18 08:01 RobinSchmidt

what are you talking about? grid lines? offset by .5? your drawing code makes wrong assumption?

elanhickler avatar Jan 23 '18 16:01 elanhickler

1.e-6 is -120db .001 amplitude is -60dB

the issue is how: do I know the amplitude of the delay without scanning the entire buffer? How do i get an amplitude value?

elanhickler avatar Jan 23 '18 16:01 elanhickler

yes, you are right. -60dB is 0.001. so, yes, -120dB seems appropriate to me. if you don't want to scan the entire buffer, you could use a formula based on the delaytime and the feedback gain to compute the time, after which the output signal has decayed to -120dB and switch to bypass after that time has passed (after the delay's input went silent). then you would need to count samples, though

RobinSchmidt avatar Jan 23 '18 19:01 RobinSchmidt

what are you talking about? grid lines? offset by .5? your drawing code makes wrong assumption?

yes, try a pixel size for a eq-plot for which the grid lines of the plot appear homogenous (for example, the default size in ToolChain). then, they are 2 pixels thick with a multiplier of 0.5 for the brightness. better would be 1 pixel thick at full brightness. and i think, it's because i'm making the wrong assumptions about where juce deems the pixel's coordinates to be (center or corner - that's a matter of convention) ...i'll probably rewrite my coordinate-system drawing code anyway. it's a huge mess with lots of code duplication (very old code)

RobinSchmidt avatar Jan 23 '18 19:01 RobinSchmidt

use a formula

...i think, you need to start with a(t) = k^(t/d) where t: time (after input went silent,) a(t): amplitude at time t, k: feedback gain, d: delaytime, so the formula for the time t should be t = d * log(a)/log(k), if i'm not mistaken. ...where you put "a" to be your target amplitude, i.e. a=1.e-6

RobinSchmidt avatar Jan 23 '18 20:01 RobinSchmidt