about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--html/tuner/index.html16
1 files changed, 8 insertions, 8 deletions
diff --git a/html/tuner/index.html b/html/tuner/index.html
index 4fe848d..20bf125 100644
--- a/html/tuner/index.html
+++ b/html/tuner/index.html
@@ -65,7 +65,7 @@
         const noteDisplay = document.getElementById('note');
 
         let audioContext;
-        let analyser;
+        let analyzer;
         let dataArray;
         let bufferLength;
 
@@ -89,12 +89,12 @@
             audioContext = new (window.AudioContext || window.webkitAudioContext)();
             const source = audioContext.createMediaStreamSource(stream);
 
-            analyser = audioContext.createAnalyser();
-            analyser.fftSize = 2048;
-            bufferLength = analyser.frequencyBinCount;
+            analyzer = audioContext.createAnalyser();
+            analyzer.fftSize = 2048;
+            bufferLength = analyzer.frequencyBinCount;
             dataArray = new Uint8Array(bufferLength);
 
-            source.connect(analyser);
+            source.connect(analyzer);
             drawWaveform();
             setInterval(detectNote, 500);
         }).catch(err => {
@@ -111,7 +111,7 @@
         function drawWaveform() {
             requestAnimationFrame(drawWaveform);
 
-            analyser.getByteTimeDomainData(dataArray);
+            analyzer.getByteTimeDomainData(dataArray);
 
             canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
             canvasCtx.beginPath();
@@ -138,8 +138,8 @@
 
         // Detect the dominant frequency and map it to a musical note
         function detectNote() {
-            const freqArray = new Float32Array(analyser.frequencyBinCount);
-            analyser.getFloatFrequencyData(freqArray);
+            const freqArray = new Float32Array(analyzer.frequencyBinCount);
+            analyzer.getFloatFrequencyData(freqArray);
 
             let maxAmp = -Infinity;
             let maxIndex = 0;