For my project, I’m building some sort of contraption to accompany Zoom classes. It’s been a chaotic week and I haven’t made as much progress as I would have liked, but I’ve been playing around with the speech recognition library in P5.js.
Here’s my code thus far:
var myRec = new p5.SpeechRec('en-US', parseResult); // new P5.SpeechRec object
myRec.continuous = true; // do continuous recognition
myRec.interimResults = true; // allow partial recognition (faster, less accurate)
var recordedString = "";
var x, y;
var dx, dy;
function setup()
{
// graphics stuff:
createCanvas(800, 600);
background(255, 255, 255);
fill(0, 0, 0, 255);
// instructions:
textSize(20);
textAlign(LEFT);
//myRec.onResult = parseResult; // now in the constructor
myRec.start(); // start engine
}
function draw()
{
text(recordedString, 20,20);
}
function parseResult()
{
var mostrecentword = myRec.resultString.split(' ').pop();
recordedString += mostrecentword;
}
I still need to add the functionality for wrapping the string and making sure that it removes a word printed if it realizes it’s actually a different word. For instance, when saying the word “happening’, “happy” would print to the screen and then “happening.”
This week, I hope to get started on building a capacitor sensor (foil inside pillow).