Audiovisualizer + text
in
Core Library Questions
•
4 months ago
Hi,
I was hoping someone could help me. I have made an audio visualizer but I want to add a text that displays 5 seconds before the audio visualizer starts.I want to show the text, when the text disapear the user can speak and the see that the audio visualizer react to their voices. This I want to do with 5 lines of text. So 5 seconds of text is displayed then the audio visualizer reacts to the users voice for about 15 seconds, then another line of text pops up en so on.
I hope you guys can help me.
Here is the code for the visualizer:
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioInput in;
FFT fft;
int w;
PImage fade;
int hVal;
float rWidth, rHeight;
void setup()
{
size(1280, 720, P3D);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 512);
fft = new FFT(in.bufferSize(), in.sampleRate());
fft.logAverages(5000, 50);
stroke(255);
w = width/fft.avgSize();
strokeWeight(w);
background(0);
fade = get(0, 0, width, height);
rWidth = width * 0.99;
rHeight = height * 0.99;
hVal = 0;
}
void draw()
{
background(0);
tint(255, 255, 255, 254 );
image(fade, (width - rWidth) /2, (height - rHeight) /4, rWidth, rHeight);
noTint();
fft.forward(in.mix);
colorMode(HSB);
stroke(hVal, 255, 255);
colorMode(RGB);
for(int i = 0; i < fft.avgSize(); i++){
line((i * w) + (w / 2), height, (i * w) + (w /2), height - fft.getAvg(i) * 4);
}
fade = get(0, 0, width, height);
for(int i = 0; i < fft.avgSize(); i++){
line((i * w) + (w / 2), height, (i * w) + (w /2), height - fft.getAvg(i) * 4);
}
hVal += 2;
if( hVal > 255)
{
hVal = 0;
}
}
1