Reference waveform()

waveform()

Returns an array of amplitude values (between -1.0 and +1.0) that represent a snapshot of amplitude readings in a single buffer. Length will be equal to bins (defaults to 1024). Can be used to draw the waveform of a sound.

Syntax

waveform([bins], [precision])

Parameters

bins
Number:

Must be a power of two between 16 and 1024. Defaults to 1024.

precision
String:

If any value is provided, will return results in a Float32 Array which is more precise than a regular array.

Returns

Array: Array Array of amplitude values (-1 to 1) over time. Array length = bins.
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