UNPKG

echogarden

Version:

An easy-to-use speech toolset. Includes tools for synthesis, recognition, alignment, speech translation, language detection, source separation and more.

23 lines 804 B
export class DecayingPeakEstimator { options; ticksPerSecond; decayPerTick; currentPeak; constructor(options, ticksPerSecond) { this.options = options; this.ticksPerSecond = ticksPerSecond; this.currentPeak = options.initialPeak; this.decayPerTick = this.options.decayPerSecond / this.ticksPerSecond; this.process = options.kind === 'maximum' ? this.processMaximum : this.processMinimum; } process; processMaximum(value) { this.currentPeak -= this.decayPerTick; this.currentPeak = Math.max(value, this.currentPeak); } processMinimum(value) { this.currentPeak += this.decayPerTick; this.currentPeak = Math.min(value, this.currentPeak); } } //# sourceMappingURL=DecayingPeakEstimator.js.map