hello!
I'm beginner ... how can I connect the sound of the microphone by a sign?
I'm beginner ... how can I connect the sound of the microphone by a sign?
I am using the minim library but can't find solutions ..
The idea would be to use the different frequencies of the voice to change the size of a form (sign) or its color.
The idea would be to use the different frequencies of the voice to change the size of a form (sign) or its color.
Help me!!!! please!!!
GRAPHIC CODE
boolean isMousePressed = false;
float areaGoccia = 1;
color coloreGoccia = color(0);
void setup () {
size (500,500);
smooth();
frameRate(120);
background(255);
}
void draw () {
if (isMousePressed) {
float speed = dist(pmouseX, pmouseY, mouseX, mouseY);
if (speed > 1) {
areaGoccia /= speed;
areaGoccia--;
} else {
areaGoccia += 5;
}
if (speed < 10) {
stroke(coloreGoccia);
strokeWeight(2.0);
strokeCap(ROUND);
line( pmouseX, pmouseY, mouseX, mouseY );
}
noStroke();
float diametro = 1.128*sqrt(areaGoccia);
ellipse(mouseX, mouseY, diametro, diametro );
ellipse(mouseX+random(6), mouseY+random(6), diametro+random(2), diametro+random(2) );
}
}
void mousePressed ()
{
isMousePressed = !isMousePressed;
if (isMousePressed) {
areaGoccia = 0;
coloreGoccia = color(random(255),random(255),random(255));
fill(coloreGoccia);
}
}
SOUND CODE
import ddf.minim.*;
import ddf.minim.analysis.*; //per aggiungere l'FFT
Minim minim;
AudioInput in;
FFT fft; //fft
void setup()
{
size(512,200,P3D);
minim = new Minim (this);
minim.debugOn();
in = minim.getLineIn(Minim.STEREO,64,11050); //forse il 512 letto dal bufferSize
//creo l'oggetto FFT passando la grandezza del buffer
//del segnale e la sua frequenza di campionamento
fft = new FFT (in.bufferSize(), in.sampleRate()); //numero di bande bufferSize
}
void draw()
{
background (255);
stroke (50);
//analizza un canale audio (left,right,mix)
fft.forward (in.mix);
//per ogni valore dello spettro calcolato disegno
//una linea con l'ampiezza relativa alla
//frequenza i getBand(i)
for (int i = 0; i < fft.specSize(); i++) //analizza 64 valori
{
line (i, height, i, height - fft.getBand(i)*4); //aggiungere nostri schizzi
}
}
void stop()
{
in.close();
minim.stop();
super.stop();
}
1