From 56023a288467290c785d96f69fb757d8638dec4e Mon Sep 17 00:00:00 2001 From: Ian Johnson Date: Wed, 27 Dec 2023 11:54:57 -0500 Subject: [PATCH] feat: add volume threshold control Closes #188 --- docs/index.html | 1 + docs/playground.html | 17 ++++++++ index.js | 99 ++++++++++++++++++++++++++++++++++++++++-- test/pitch-detector.js | 77 +++++++++++++++++++++++++++++++- 4 files changed, 190 insertions(+), 4 deletions(-) diff --git a/docs/index.html b/docs/index.html index 9064ae6..72b1531 100644 --- a/docs/index.html +++ b/docs/index.html @@ -103,6 +103,7 @@

Pitchy example

navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => { audioContext.createMediaStreamSource(stream).connect(analyserNode); const detector = PitchDetector.forFloat32Array(analyserNode.fftSize); + detector.minVolumeDecibels = -10; const input = new Float32Array(detector.inputLength); updatePitch(analyserNode, detector, input, audioContext.sampleRate); }); diff --git a/docs/playground.html b/docs/playground.html index 7680310..6b4a79f 100644 --- a/docs/playground.html +++ b/docs/playground.html @@ -137,6 +137,13 @@

Pitchy playground

Data quality +
+ +
+