home/ atoms/ amplitude-analysis-rms

RMS amplitude gives a perceptually smooth loudness value between 0 and 1

Root Mean Square (RMS) amplitude averages the squared sample values over a short window and takes the square root, producing a single number that tracks perceived loudness much better than a peak sample value. In p5.sound, p5.Amplitude.getLevel() returns an RMS reading in the range 0.0–1.0, typically peaking around 0.5 in practice. A smoothing coefficient (via smooth()) can be applied to reduce jitter between frames. Because RMS correlates with perceived loudness, it is the natural driver for amplitude-reactive visuals: the visual intensity feels proportional to how loud the music sounds, not to instantaneous sample spikes.

Examples

let amp = new p5.Amplitude(); amp.smooth(0.8); let level = amp.getLevel(); // 0.0–1.0 ellipse(width/2, height/2, level * 200, level * 200);

Assessment

Explain why RMS is preferred over peak amplitude for visual reactivity; describe what smooth() does and what artifact it reduces.

“`.getLevel()` returns a Root Mean Square (RMS) amplitude reading, between 0.0 and 1.0, usually peaking at 0.5”
corpus · visualizing-music-with-p5-js-jason-sigal-audio-reactive-work · chunk 2