xxxxxxxxxx
var foo = new p5.Speech();
foo.interrupt = true;
foo.onLoad = speechLoaded;
var bar = new p5.SpeechRec('en-US'); // this is a speech recognition object
bar.onResult = gotspeech; // this is a callback function
bar.continuous = true; // continuous recognition
//bar.interimResults = true; // fragmented recognition
var x;
var y;
var xi=0;
var yi=0;
var sp=1;
var r = 60;
var g = 60;
var b = 60;
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
textSize(80);
bar.start(); // start the speech recognition
}
function draw() {
}
function mousePressed()
{
}
function speechLoaded() {
foo.setVoice("Google UK English Female");
}
function gotspeech() {
background(255);
s = bar.resultString; // get the last word you heard
text(s, 0,height/2);
foo.speak(s);
}