xxxxxxxxxx
let speech;
let input = "...";
let bg;
let table;
let out;
let c = 1;
function setup() {
//createCanvas(1080, 1920);
background(250);
//speech = new p5.SpeechRec('de-DE'); // speech recognition object (will prompt for mic access)
// de-DE; en-EN
speech = new p5.SpeechRec('en-EN');
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('time');
table.addColumn('text');
createCanvas(1000, 1000);
frameRate(1)
//bg = color(255);
}
function draw() {
let newRow = table.addRow();
newRow.setString('time', Date());
newRow.setString('text', input);
//background(255, 0, 0);
text(input, 20, c*20);
//ellipse(500,500, 5,5);
c++;
input = "...";
if (c*20>1000){
background(250);
c = 1;
}
}
function showResult()
{
input = speech.resultString;
//out += input;
}
function keyPressed() {
if (key == "c") {
save(table, 'Transcript.csv');
}
}