Voce / Voice recognizer / Show color when word recognize
in
Contributed Library Questions
•
8 months ago
Hi,
i just download Voce and built it in processing, it works pretty well,
There is only one thing i can't do : i want it to recognize when i say "cat" or "fish" and for example when i say "cat" i want the background to become blue and when i say fish i want the background to become green.
But it only take the last background color line... i can't seems to find a solution.
Please help, i'm a newbie.
Thanks
i just download Voce and built it in processing, it works pretty well,
There is only one thing i can't do : i want it to recognize when i say "cat" or "fish" and for example when i say "cat" i want the background to become blue and when i say fish i want the background to become green.
But it only take the last background color line... i can't seems to find a solution.
Please help, i'm a newbie.
Thanks
- import voce.*;
String s;
int xPos = 0;
int yPos = 0;
void setup() {
size(480, 200);
background(0);
voce.SpeechInterface.init("voce/library", true, true,
"voce/library/gram", "cat");
System.out.println("This is an awesome test");
textFont(createFont("NeutraTextTF-BookItalicAlt", 24));
}
void draw() {
background(0);
stroke(255);
while (voce.SpeechInterface.getRecognizerQueueSize () > 0)
{
s = voce.SpeechInterface.popRecognizedString();
println(s);
voce.SpeechInterface.synthesize(s);
text(s,50,50);
if (s == "cat"); {
background(0, 255, 0) ;
}
if (s == "fish"); {
background(0, 0, 255) ;
}
}
}
1