import { clamp01 } from "@thi.ng/math/interval" ; import { Delay } from "./delay.js" ; /**
 * Extension of  Delay which adds sum delayed value multiplied
 * with `feedback` for each new input.
 *
 *  param n param feedback export const feedbackDelay = ( n , feedback ? ) => new FeedbackDelay ( n , feedback ) ; export class FeedbackDelay extends Delay < number > { constructor ( n , protected _feedback = 0.5 ) { super ( n , 0 ) ; this . setFeedback ( _feedback ) ; } next ( x ) { return super . next ( x + this . _buf [ this . _rpos ] * this . _feedback ) ; } feedback ( ) { return this . _feedback ; } setFeedback ( feedback ) { this . _feedback = clamp01 ( feedback ) ; } }