Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.52k stars 983 forks source link

Analyser constructor bugfix for ignored smoothing option #940

Closed marcelblum closed 3 years ago

marcelblum commented 3 years ago

Fix for the following bug: smoothing setting in the Analyser constructor is ignored (smoothing always ends up with the default value 0.8). Fixed by explicitly calling the smoothingTimeConstant setter in the constructor.

marcelblum commented 3 years ago

Oh and just to clarify, to repro the bug:

const analyser = new Tone.Analyser({ type: "waveform", smoothing: .4, size: 512 });
console.log(analyser.smoothing);
//0.8
console.log(analyser._analysers[0]._nativeAnalyserNode.smoothingTimeConstant);
//0.8
tambien commented 3 years ago

thank you!