diff --git a/.analyze.js.swp b/.analyze.js.swp new file mode 100644 index 0000000..de9614f Binary files /dev/null and b/.analyze.js.swp differ diff --git a/.app.js.swp b/.app.js.swp new file mode 100644 index 0000000..8df8837 Binary files /dev/null and b/.app.js.swp differ diff --git a/analyze.js b/analyze.js index 334dd69..4ab497f 100644 --- a/analyze.js +++ b/analyze.js @@ -6,7 +6,14 @@ function startPitchDetection(callback) { } // Request access to the microphone - navigator.mediaDevices.getUserMedia({ audio: true }) + //navigator.mediaDevices.getUserMedia({ audio: true }) + navigator.mediaDevices.getUserMedia({ + audio: { + echoCancellation: false, + noiseSuppression: false, + autoGainControl: false + } +}) .then(stream => { // Create an audio context and an analyser node const audioContext = new (window.AudioContext || window.webkitAudioContext)(); diff --git a/app.js b/app.js index 8fb7dbb..f957658 100644 --- a/app.js +++ b/app.js @@ -76,7 +76,7 @@ maxInput.addEventListener('change', ()=>{ }) startPitchDetection((heardPitch)=>{ - if(newTone) { + if(heardPitch !== -1 && newTone) { const centsDifference = 1200 * Math.log2(heardPitch / newTone) document.querySelector('#analyze-pitch input[type="range"]').value = centsDifference }