diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2017-11-27 21:48:42 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2017-11-27 21:48:42 +0200 |
commit | 5e0a70fa9b181637942d3d0d55f6a51c33fefbad (patch) | |
tree | 2a89ba1f95cd0ada966e3ab5cf8acba1a8a22934 | |
parent | 9cdda723cc90492cd4ac1fb32d31e5077293a2b9 (diff) |
Tweaked webaudio settings to decrease latency a little and remove incorrect smoothing
-rw-r--r-- | web/main.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/web/main.js b/web/main.js index 1d65e7a..97609e3 100644 --- a/web/main.js +++ b/web/main.js @@ -165,9 +165,9 @@ function initView() { document.getElementById('rusty-microphone').removeAttribute('style'); function draw(signal, timestamp, pitch, error) { - updateFramerate(timestamp); - updatePitchIndicators(pitch, error); drawDebugGraph(signal); + updatePitchIndicators(pitch, error); + updateFramerate(timestamp); } function updateFramerate(timestamp) { @@ -248,12 +248,13 @@ function main() { var input = context.createMediaStreamSource(stream); var analyser = context.createAnalyser(); analyser.fftSize = 512; + analyser.smoothingTimeConstant = 0; input.connect(analyser); var view = initView(); + var dataArray = new Float32Array(analyser.fftSize); function analyserNodeCallback(timestamp) { - var dataArray = new Float32Array(analyser.fftSize); analyser.getFloatTimeDomainData(dataArray); update(view, dataArray, context.sampleRate, timestamp); window.requestAnimationFrame(analyserNodeCallback); |