Examples Visualizing Sound

Visualizing Sound

Analyzing the instantaneous loudness of a sound doesn’t always provide enough information to create rich visual outputs (see the previous example, Measuring Amplitude).

Sometimes we will want to measure the loudness of individual frequency bands to create more complex visualizations. To do this, we’ll use the p5.FFT class, which returns a “spectral analysis” of the input signal.

The analyze method returns individual values for each ‘frequency band’ which we can use to draw distinct paths for the lows, mids, and high frequency ranges of a sound.

Using the waveform method we can also retrieve the last 1024 sample values in order to visualize the waveform the sound’s waveform.

Creative Commons BY-NC-SA license badge

Visualizing Sound: Edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.