We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › different volume-> different text
Page Index Toggle Pages: 1
different volume-> different text (Read 443 times)
different volume-> different text
Mar 3rd, 2008, 1:16pm
 
Sorry if i do silly questions and my english is poor, but i need help to realize an interactive installation for my univeristy course, and this is first time that i use Processing...

I read some example, something interesting, but not clear enought to do that i want.

And that i want is:
when i speak in microphone, some text appear on screen.
If i speak with low voice, but if i speak a little more highter another text appear, and so on...

Which library is the best (and Easier)?
Do you know some example that i can see to understand better what i have to do?

Thank you!
Re: different volume-> different text
Reply #1 - Mar 4th, 2008, 6:12pm
 
Using the ESS library, this is easy.  Check out this example: http://www.tree-axis.com/Ess/_examples/inputFFT/inputFFT.pde

It shows how to read and FFT realtime audio input.  For the text, I would make an array of Strings, and depending on which FFT bin was the highest, display the String from the array associated with that bin.

So, if you had 256 bins in the FFT, you could have 256 Strings in an array.  If bin #1 was the highest, display String #1, etc.
Re: different volume-> different text
Reply #2 - Mar 5th, 2008, 10:28pm
 
Thanks for your answer, before i read your message, i try something with sonia:
----------------------------------------------------
import pitaru.sonia_v2_9.*;



void setup(){
 size(600,600);
 Sonia.start(this);
 LiveInput.start(256);
 }

void draw(){
 background(256,256,256);
 getMeterLevel();//mostra il volume
 }
 
void getMeterLevel(){
 float meterDataRight=LiveInput.getLevel();
 
 
 PFont fontA = loadFont("CourierNew36.vlw");
 textFont(fontA, 36);
 
 if(meterDataRight>=0.01&&meterDataRight<0.2){
   text("word",50,50);
   fill(0);
   }
 if(meterDataRight>=0.2&&meterDataRight<0.3){
   text("Hello",200,100);
   fill(0);
   }
 if(meterDataRight>=0.3&&meterDataRight<0.4){
   text("STRong",400,300);
   fill(0);
   }
 if(meterDataRight>=0.4){
   text("CRY!!!",150,500);
   fill(0);
   }
}

public void stop(){
 Sonia.stop();
 super.stop();
 }
------------------------------------------

but i don't know how i can do 2 things (i know that will be stupid... but this is my first code Smiley):

1) how can i take on screen the word for more time? and make it disappear slowly?
2) how word can appear in random position on screen?

Thanks.
Page Index Toggle Pages: 1