From 93b60fc562fda690c0ac35a423e0b5fb609d9a42 Mon Sep 17 00:00:00 2001 From: jbphet Date: Tue, 6 Apr 2021 17:45:17 -0600 Subject: [PATCH] improved docs, see #133 --- js/PeakDetectorAudioNode.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/PeakDetectorAudioNode.js b/js/PeakDetectorAudioNode.js index e0527ffb..4ffa51cc 100644 --- a/js/PeakDetectorAudioNode.js +++ b/js/PeakDetectorAudioNode.js @@ -3,8 +3,18 @@ /** * PeakDetectorAudioNode is a Web Audio node that can be used to detect peak audio output values in an audio signal * chain. The detected peak audio values are output to the console. This file contains the portion that runs in the - * main JavaScript thread, which appears to be referred to as the "AudioWorklet Node". There is a counterpart portion - * that runs in the Web Audio rendering thread that is referred to as the "AudioWorklet Processor". + * main JavaScript thread, which is referred to as the "AudioWorklet Node" in the online documentation. There is a + * counterpart portion that runs in the Web Audio rendering thread that is referred to as the "AudioWorklet Processor". + * + * This is intended for diagnostic purposes only, and should not be included in production code. It likely won't work + * in built code anyway, since it makes a direct file reference for including the worklet processor code. + * + * Also note that as of this writing (Apr 2021), audio worklets are not supported in Safari. + * + * To use, create an instance and connect the node whose output you want to measure. Example: + * + * const peakDetector = new PeakDetectorAudioNode(); + * this.masterGainNode.connect( peakDetector ); * * @author John Blanco (PhET Interactive Simulations) */