xxxxxxxxxx
let myVoice = new p5.Speech();
let button;
let foods = ["SmokeShack", "Cheese Fries", "ShackStack", "Shroom Burgers", "Fifty Fifty", "Hot Dog", "Chicken Dog", "Shack Attack", "Jackpot"];
let food1;
function preload(){
img = loadImage('photos.png');
}
function setup() {
createCanvas(1110, 840);
background(0);
food1 = foods[floor(random(0, foods.length))];
myVoice.setPitch(random(0.5, 1.0));
myVoice.setRate(random(1.0, 1.25));
button = createButton("Let's Shake");
button.position(width / 2 - 100, 480);
button.size(300, 75);
button.style("font-size", 50+"px");
button.mousePressed(talk);
}
function draw() {
background(img);
}
function talk() {
myVoice.setVoice('Google US Male');
myVoice.speak('I would like to order ' + food1);
myVoice.setPitch(random(0.5, 1.0));
myVoice.setRate(random(1.0, 1.25));
food1 = foods[floor(random(0, foods.length))];
}