i'm working on a speech to text + arduino proyect. For that, im using processing with the library https://github.com/alexandrainst/processing_websockets for the speech to text part. So far, it works, i talk and i get printed both as command line and as a text on the canvas the words i speak. The thing is i need to execute a change on a background when the word "zangolotino" is said. And that, does not work.
My code is this
/*
Simple WebSocketServer example that can receive voice transcripts from Chrome
Requires WebSockets Library: https://github.com/alexandrainst/processing_websockets
*/
import websockets.*;
PImage bgEstado;
String palabraClave;
Boolean estado;
WebsocketServer socket;
void setup() {
socket = new WebsocketServer(this, 1337, "/p5websocket");
size(600,600);
palabraClave = "";
estado = true;
if(palabraClave == "zangolotino"){
bgEstado = loadImage("bg1.png");
} else {
bgEstado = loadImage("bg2.png");
}
}
void draw() {
background(0);
image(bgEstado, 0, 0);
text(this.palabraClave, 200, 200);
}
void webSocketServerEvent(String msg){
println(msg);
palabraClave = msg;
println(palabraClave);
}
I talk, and "zangolotino" is stored correctly on palabraClave, however the background never changes from bg2.png to bg1.png.
Any insights? Thanks