Reference p5.OnsetDetect

p5.OnsetDetect

Listen for onsets (a sharp increase in volume) within a given frequency range.

Syntax

p5.OnsetDetect(freqLow, freqHigh, threshold, callback)

Parameters

freqLow
Number:

Low frequency

freqHigh
Number:

High frequency

threshold
Number:

Amplitude threshold between 0 (no energy) and 1 (maximum)

callback
Function:

Function to call when an onset is detected

Notice any errors or typos? Please let us know. Please feel free to edit lib/addons/p5.sound.js and open a pull request!

Related References