p5.sound wraps the Web Audio API in a Processing-style interface for audio analysis and playback
p5.sound.js is an addon library for p5.js that exposes the browser’s Web Audio API through a Processing-idiomatic JavaScript interface. It provides ready-made objects for loading and playing sound files (p5.SoundFile), measuring amplitude (p5.Amplitude), frequency analysis (p5.FFT), microphone input (p5.AudioIn), and peak/beat detection (p5.PeakDetect). This abstraction reduces the boilerplate of working with AudioContext, AnalyserNode, and ScriptProcessorNode directly, making audio-reactive browser sketches accessible to creative coders without a DSP background.
Examples
new p5.SoundFile(‘track.mp3’); new p5.Amplitude(); new p5.FFT(smoothing, binCount) — all operate within the p5.js setup()/draw() loop.
Assessment
Name four p5.sound classes and the DSP operation each provides; explain what the Web Audio API is and why wrapping it simplifies audio-reactive sketches.