This repository has been archived by the owner on Jul 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
speak and listen then puzzle 1.xml
73 lines (73 loc) · 19.3 KB
/
speak and listen then puzzle 1.xml
1
<project name="speak and listen then puzzle 1" app="Snap! 4.0, http://snap.berkeley.edu" version="1"><notes></notes><thumbnail>data:image/png;base64,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</thumbnail><stage name="Stage" width="480" height="360" costume="0" tempo="60" threadsafe="false" lines="round" codify="false" inheritance="false" sublistIDs="false" scheduled="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAOhUlEQVR4Xu3VwQkAAAjEMN1/abewn7jAQRC64wgQIECAAIF3gX1fNEiAAAECBAiMAHsCAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQIHLFxAWmhEwHPAAAAAElFTkSuQmCC</pentrails><costumes><list id="2"></list></costumes><sounds><list id="3"></list></sounds><variables></variables><blocks></blocks><scripts><script x="167" y="129"><block s="receiveGo"></block><custom-block s="Turn off unloading warnings"></custom-block></script></scripts><sprites><sprite name="Sprite" idx="1" x="0" y="0" heading="90" scale="1" rotation="1" draggable="true" costume="0" color="80,80,80" pen="tip" id="10"><costumes><list id="11"></list></costumes><sounds><list id="12"></list></sounds><variables></variables><blocks></blocks><scripts><script x="21" y="18"><block s="receiveGo"></block><custom-block s="speak %s then %cmdRing in language %s with pitch %n with rate %n with voice %n with volume %n"><l>Say something</l><block s="reifyScript"><script><custom-block s="listen"></custom-block></script><list></list></block><l></l><l></l><l></l><l></l><l></l></custom-block></script><script x="24" y="224"><block var="last thing spoken"/></script><script x="23" y="258"><block s="reportJoinWords"><list><l>hello </l><l>world</l></list></block></script><script x="18" y="174"><custom-block s="speak %s then %cmdRing in language %s with pitch %n with rate %n with voice %n with volume %n"><l></l><block s="reifyScript"><script></script><list></list></block><l></l><l></l><l></l><l></l><l></l></custom-block></script><script x="18" y="116"><block s="receiveMessage"><l>heard something</l></block></script></scripts></sprite><watcher var="last thing spoken" style="normal" x="10" y="10" color="243,118,29"/><watcher var="listening" style="normal" x="10" y="31.000001999999995" color="243,118,29" hidden="true"/></sprites></stage><hidden></hidden><headers></headers><code></code><blocks><block-definition s="speak %'text' %'what to do when finished'" type="command" category="sound"><header></header><code></code><inputs><input type="%s"></input><input type="%cmdRing"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>message</l><l>finished_callback</l></list><l>var utterance = new SpeechSynthesisUtterance(message);





if (typeof finished_callback === 'object') {





 // callback provided





 utterance.onend = function (event) {





 invoke(finished_callback, new List([message]));





 };





}





if (window.speech_recognition) {





 window.speech_recognition.abort();





}





window.speechSynthesis.speak(utterance);





</l></block><list><block var="text"/><block var="what to do when finished"/></list></block></script></block-definition><block-definition s="listen and then %'do with recognised words' %'do if nothing recognised'" type="command" category="other"><header></header><code></code><inputs><input type="%cmdRing"></input><input type="%cmdRing"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>spoken_callback</l><l>error_callback</l></list><l>var restart = function () {





 if (window.speechSynthesis.speaking) { // don't listen while speaking





 // there remains the possibility of speech happening after recognition starts





 setTimeout(restart, 500); // try again in half a second





 return;





 }





 try {





 window.speech_recognition.start();





 console.log("recognition started");





 } catch (error) {





 if (error.name === 'InvalidStateError') {





 // delay needed at least in Chrome 52





 setTimeout(restart, 2000);





 } else {





 console.log(error);





 }





 }





};





var handle_result = function (callback, event) {





 var spoken = event.results[0][0].transcript;





 console.log("Confidence is " + event.results[0][0].confidence + " for " + spoken, spoken_callback);





 window.speech_recognition.stop();





 invoke(callback, new List([spoken]));





};





var handle_error = function (callback, event) {





 if (event.error === 'aborted') {





 console.log("aborted so restarting speech recognition in half a second");





 setTimeout(restart, 500);





 return;





 }





 if (event.error === 'no-speech') {





 window.speech_recognition.onend = null;





 window.speech_recognition.onresult = null;





 window.speech_recognition.stop();





 }





 console.log("Recognition error: " + event.error);





 if (typeof callback === 'object') {





 invoke(callback, new List([event.error]));





 }





};





if (!window.speech_recognition) {





 window.speech_recognition = (typeof SpeechRecognition === 'undefined') ? 





 new webkitSpeechRecognition() :





 new SpeechRecognition();





}





window.speech_recognition.onresult = function (event) {





 handle_result(spoken_callback, event);





};





window.speech_recognition.onerror = function (event) {





 handle_error(error_callback, event);





};





window.speech_recognition.onend = function (event) {





 console.log("recognition ended");





 restart(); 





};





restart();





</l></block><list><block var="do with recognised words"/><block var="do if nothing recognised"/></list></block></script></block-definition><block-definition s="listen" type="command" category="other"><header></header><code></code><inputs></inputs><script><custom-block s="Turn off unloading warnings"></custom-block><block s="doSetVar"><l>listening</l><block s="reportBoolean"><l><bool>true</bool></l></block></block><custom-block s="listen and then %cmdRing %cmdRing"><block s="reifyScript"><script><block s="doSetVar"><l>last thing spoken</l><block var="spoken"/></block><block s="doBroadcast"><l>heard something</l></block><custom-block s="listen"></custom-block></script><list><l>spoken</l></list></block><block s="reifyScript"><script><block s="doSetVar"><l>speech recognition error</l><block var="error"/></block><block s="doBroadcast"><l>speech recognition error</l></block><block s="doIf"><block var="listening"/><script><block s="doIfElse"><block s="reportEquals"><block var="speech recognition error"/><l>no-speech</l></block><script><custom-block s="speak %s %cmdRing"><l>I didn't hear anything for a while. Bye.</l><block s="reifyScript"><script></script><list></list></block></custom-block><block s="doSetVar"><l>listening</l><block s="reportBoolean"><l><bool>false</bool></l></block></block></script><script><custom-block s="speak %s %cmdRing"><block s="reportJoinWords"><list><l>There was an error. </l><block var="speech recognition error"/></list></block><block s="reifyScript"><script></script><list></list></block></custom-block><block s="bubble"><block s="reportJoinWords"><list><l>There was an error. </l><block var="speech recognition error"/></list></block></block><custom-block s="speak %s %cmdRing"><l>Try again.</l><block s="reifyScript"><script><custom-block s="listen"></custom-block></script><list></list></block></custom-block></script></block></script></block></script><list><l>error</l></list></block></custom-block></script></block-definition><block-definition s="Turn off unloading warnings" type="command" category="other"><header></header><code></code><inputs></inputs><script><block s="doRun"><block s="reportJSFunction"><list></list><l>window.onbeforeunload = null;</l></block><list></list></block></script></block-definition><block-definition s="speak %'text' then %'what to do when finished' in language %'language code' with pitch %'pitch' with rate %'rate' with voice %'voice' with volume %'volume'" type="command" category="sound"><header></header><code></code><inputs><input type="%s"></input><input type="%cmdRing"></input><input type="%s"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>message</l><l>finished_callback</l><l>lang</l><l>pitch</l><l>rate</l><l>voice</l><l>volume</l></list><l>// see https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance
var utterance = new SpeechSynthesisUtterance(message);
if (lang) {
 utterance.lang = lang;
}
if (pitch > 0) {
 utterance.pitch = pitch;
}
if (rate > 0) {
 if (rate < .1) {
 // A very slow rate breaks Chrome's speech synthesiser
 rate = .1;
 }
 if (rate > 2) {
 rate = 2; // high rate also breaks Chrome's speech synthesis
 }
 utterance.rate = rate;
}
if (voice) {
 voices = window.speechSynthesis.getVoices();
 if (voice >= 0 && voice < voices.length) {
 utterance.voice = voices[Math.floor(voice)];
 } else {
 alert("Only " + voices.length + " voices are available. You can't choose voice number " + voice);
 }
}
if (volume > 0) {
 utterance.volume = volume;
}
if (typeof finished_callback === 'object') {
 // callback provided
 utterance.onend = function (event) {
 invoke(finished_callback, new List([message]));
 };
}
if (window.speech_recognition) {
 window.speech_recognition.abort();
}
window.speechSynthesis.speak(utterance);
</l></block><list><block var="text"/><block var="what to do when finished"/><block var="language code"/><block var="pitch"/><block var="rate"/><block var="voice"/><block var="volume"/></list></block></script></block-definition><block-definition s="voice name %'voice'" type="reporter" category="sound"><header></header><code></code><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>voice</l></list><l>var voices = window.speechSynthesis.getVoices();




if (voice >= 0 && voice < voices.length) {




 return voices[Math.floor(voice)].name;




} else {




 alert("Only " + voices.length + " voices are available. You can't choose voice number " + voice);




}</l></block><list><block var="voice"/></list></block></block></script></block-definition></blocks><variables><variable name="last thing spoken"><l>say something</l></variable><variable name="listening"><bool>true</bool></variable></variables></project>