Lookahead limiter
Posted: Wed Jul 27, 2016 2:04 am
This is my simple approach to lookahead limiter. Feel free to optimize it. The biggest CPU hog is max from array...
DSP Robotics and FlowStone Graphical Programming Software Support and Forums
http://www.dsprobotics.com/support/
KG_is_back wrote:Hi, I've done some research and it turns out it is possible to implement the "max from array" in O(1) steps (meaning the overall CPU usage will be independent of array-size). Here's a module I've made. Unfortunately it had to be done in assembler, but pseudocode is included. I have no idea how the algorithm works (some stack-based trickery).
One disadvantage of the module is, that the window-size must be set at stage(0), meaning you can't change it on the fly without glitches...
It can also be modified to calculate min from buffer...
tulamide wrote: Where did you find it?
KG_is_back wrote:tulamide wrote: Where did you find it?
on stackoverflow... http://stackoverflow.com/questions/32436689/find-maxand-min-on-the-moving-interval-using-python
I always knew this O(1) algorithm should exist, but I could not figure out how it should work... until I've found this one...
Note that my implementation uses one buffer, where first part is the push stack and second part is the pop stack and the division between them is just a pointer ("i" variable). I've found that this way I don't have to copy the input buffered values and I only have to recalculate the maxima in pop stack.
KG_is_back wrote:I think I've found what the issue was. It was some sort of weird input update for the streams vs. green when it comes to stage(0).
This one should work fine...
KG_is_back wrote:Hi, I've done some research and it turns out it is possible to implement the "max from array" in O(1) steps (meaning the overall CPU usage will be independent of array-size). Here's a module I've made.
Youlean wrote:Filters do make a lot of difference. I wonder if there is some better filter for this job...
KG_is_back wrote:I think I've found what the issue was. It was some sort of weird input update for the streams vs. green when it comes to stage(0).
This one should work fine...
nmakinen wrote:could the algorithm above be modified to calculate the average of the buffer as well?
nmakinen wrote:There still seems to be a minor issue. Sometimes when you change the window size on the fly when audio is put through, it loses all the information below a certain level (which seems to be random every time). Hard to explain, so I've attached an image about the problem.