xxxxxxxxxx
let speech;
let input = "...";
let bg;
let table;
let t = "...";
let d = Date();
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
speech = new p5.SpeechRec('de-DE'); // speech recognition object (will prompt for mic access)
speech.onResult = showResult; // bind callback function to trigger when speech is recognized
speech.continuous = true; // do continuous recognition
speech.interimResults = true;
speech.start(); // start listening
textAlign(CENTER, CENTER);
textSize(200);
table = new p5.Table();
table.addColumn('realtime');
table.addColumn('saidtime');
//table.addColumn('text');
table.addColumn('try');
createCanvas(1080, 1920);
frameRate(1)
//bg = color(255);
}
function draw() {
let newRow = table.addRow();
newRow.setString('realtime', Date());
//newRow.setString('text', input);
if (t === input) {
}
else {
newRow.setString('saidtime', d);
newRow.setString('try', input);
t = input;
d = Date();
}
background(255);
text(input, width/2, height/2);
}
function showResult()
{
input = speech.resultString;
}
function keyPressed() {
if (key == "c") {
saveTable(table, 'Transcript.csv');
}
}