xxxxxxxxxx
51
var myVoice = new p5.Speech(); // new P5.Speech object
var startTime = 0; // Used to control start of speak function
var phr=["Test1", "Test2", "Test3", "Test4"];
var input;
function setup()
{
createCanvas(400,400);
background(0);
myVoice.setVolume(20);
myVoice.setPitch(120/100);
myVoice.setRate(75/100);
input=createButton("Activate Sound");
input.touchStarted(actSound);
}
function draw()
{
// why draw when you can click?
}
function touchStarted()
{
if((mouseY<height) && (mouseX<width))
tt();
}
function tt()
{
myVoice.interrupt=false;
myVoice.speak();
}
function actSound()
{
//userStartAudio();
myVoice.cancel();
myVoice.speak("Active");
input.hide();
}