Basic audio analyser. Returns FFT analysis. Use analyserPeakLevel if you want the sound level, or analyserBasic if you also want the waveform.
constonData = (freq, analyser) => { // Demo: Print out each sound frequency (Hz) and amount of energy in that band for (leti=0;i<freq.length;i++) { constf = analyser.getFrequencyAtIndex(0); console.log(`${i}. frequency: ${f} amount: ${freq[i]}`); } } analyserFrequency(onData, {fftSize:512});
Note: Browers won't allow microphone access unless the call has come from a user-interaction, eg pointerup event handler.
Basic audio analyser. Returns FFT analysis. Use analyserPeakLevel if you want the sound level, or analyserBasic if you also want the waveform.
Note: Browers won't allow microphone access unless the call has come from a user-interaction, eg pointerup event handler.