Kristan
Kristan

Reputation: 11

P5js into music visualizer

I have a P5js sketch I am looking to convert into a audio sensitive visualizer. See below.

https://editor.p5js.org/Kghj/full/fn2N0xrF1

When there is heavy bass the slider should move left and fuzzy should be ticked, then when a new sound or sudden pitch change the shape should change and stroke should toggle on and off. I have experience using java, ruby on rails, and react. This is not really a code specific question but asking for a point in the right direction.

Upvotes: 1

Views: 729

Answers (1)

Paul Wheeler
Paul Wheeler

Reputation: 20160

You'll want to use FFT.analyze and then check the values at different frequency buckets to determine changes in pitch or the set of notes being played. Bass/drum hits tend to show up as a pulse of energy across a wide range of frequencies. How exactly you detect change in the audio and relate them to visual effects is pretty open ended. For some things you might want to just use the amount of energy at a precise frequency, for others you might want to take the derivative of energy at a particular frequency over time (the rate of change) and trigger something when the that slope reaches some threshold.

In addition to p5.sound you could also use Tone.js instead. It is similar but more advanced/extensive, and it will work just as well with p5.js.

Upvotes: 1

Related Questions