Skip to content

How to execute to getEnergy() #115

Closed Answered by ffd8
akkolad asked this question in Q&A
Feb 24, 2025 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hey @akkolad – I moved the audio reactivity code to the backend and thooought I documented using it in the readme?? but perhaps it's only documented in the demo : demos » audio » _audio_analysis

Anyways there's already an FFT object loaded, you can check out what's happening behind the scenes in p5live-audio.js – but essentially you just need to attach the getEnergy() to the exposed variable called fftRaw (fft is the already filtered array of values). Here's an example:

function setup() {
	createCanvas(windowWidth, windowHeight)
	setupAudio(true) // true makes all audio variables GLOBAL, otherwise use `a5.` in front of each var
}

function draw() {
	updateAudio()
	
	// print(fftRaw.getEne…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@akkolad
Comment options

Answer selected by ffd8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants