X-AI-1 uses a ScratchX Text-to-Speech engine and a ScratchX Voice Recognition engine. I put the script in the Notes and Credits, but you can also find the source code for the speech synthesis at http://sayamindu.github.io/scratch-extensions/text-to-speech/text_to_speech_extension.js and the source code for the speech recognition at http://sayamindu.github.io/scratch-extensions/speech_to_text_extension.js To use the extensions, copy the JavaScript code to your computer's clipboard (⌘C, Ctrl+C, et cetera). Next, (for Google Chrome, on Mac) open the command menu at the top and go to View>>Developer>>Developer Tools to reach the JS console (click where it says "Console" at the top of the window that pops up). I don't know where the console is on other operating systems or browsers, but hopefully the console would be in it somewhere. Paste the script you copied into the command prompt and press Enter. Close the console, and stay on the page. The ScratchX engines should work then. Please note: you must reload the extension each time you load the page. I think. If you use speech rec (short for speech recognition), use turbo mode. X-AI-1 learns from human behavior and will try to mimic a human's thought process. It (X-AI-1 is an it because of being gender-neutral) is NOT sentient: it cannot come up with it's own ideas. It will just mimic how it is treated.
==========NOTICE - Please, PLEASE read!========= Until training has progressed far enough, X-AI will only learn from me and select people. Sorry about that. This is in place to keep someone from telling X-AI to say the wrong thing (eg. insults, advertising, etc.). Thank you for understanding. Notes: The training system is sensitive. It doesn't take much to destroy the whole sync system. Also, use proper grammar and spelling: this is a requirement for the algorithm. Credits: @ELIAPPLE7 created the voice assistant script. With permission, I integrated it into X-AI-1_V0.1.3 beta Progress bar by @NickyNouse Parser by I found the loading GIF through Google, and here is the URL: https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&ved=0ahUKEwjqtr3S9pjLAhXI0iYKHZvVCpQQjRwIBw&url=https%3A%2F%2Fwww.pinterest.com%2Fmintcodecojp%2Floading-gif%2F&psig=AFQjCNG0YItaiEhUFQRkRwaRuYbNp3_KuA&ust=1456691113460761 X-AI-1's algorithm/system is based off the kind Cleverbots use. When you tell it something one of two things will happen: if it has been told this before, it will respond the way it did then. --OR-- if it has not been told this before, it will ask how it should respond. However, the Cleverbots use a sentence analyzer that allows them to find the closest thing they know how to respond to. and I are trying to figure out how to do the same thing with the natural language parser. Speech synthesis script: new (function() { var ext = this; /*function _get_voices() { var ret = []; var voices = speechSynthesis.getVoices(); for(var i = 0; i < voices.length; i++ ) { ret.push(voices[i].name); console.log(voices.toString()); } return ret; } ext.set_voice = function() { };*/ ext.speak_text = function (text, lang, callback) { var u = new SpeechSynthesisUtterance(text.toString()); u.lang = lang; u.onend = function(event) { if (typeof callback=="function") callback(); }; speechSynthesis.speak(u); }; ext._shutdown = function() {}; ext._getStatus = function() { if (window.SpeechSynthesisUtterance === undefined) { return {status: 1, msg: 'Your browser does not support text to speech. Try using Google Chrome or Safari.'}; } return {status: 2, msg: 'Ready'}; }; var descriptor = { blocks: [ //['', 'set voice to %m.voices', 'set_voice', ''], ['w', 'speak %s in %m.langs', 'speak_text', 'Hello!', 'en-US'], ], menus: { langs: ['en-US', 'en-GB', 'de-AT', 'fr-FR'], //voices: _get_voices(), }, }; ScratchExtensions.register('Text to Speech', descriptor, ext); })(); Speech Rec: new (function() { var ext = this; var recognized_speech = ''; ext.recognize_speech = function (callback) { var recognition = new webkitSpeechRecognition(); recognition.onresult = function(event) { if (event.results.length > 0) { recognized_speech = event.results[0][0].transcript; if (typeof callback=="function") callback(); } }; recognition.start(); }; ext.recognized_speech = function () {return recognized_speech;}; ext._shutdown = function() {}; ext._getStatus = function() { if (window.webkitSpeechRecognition === undefined) { return {status: 1, msg: 'Your browser does not support speech recognition. Try using Google Chrome.'}; } return {status: 2, msg: 'Ready'}; }; var descriptor = { blocks: [ ['w', 'wait and recognize speech', 'recognize_speech'], ['r', 'recognized speech', 'recognized_speech'] ], }; ScratchExtensions.register('Speech To Text', descriptor, ext); })(); Version history: 2/11/16 - V0.1.2 alpha build - Status variable added; various bugs fixes with BIOS; more efficient source code 2/16/16 - V0.1.3 beta - Integrated ELIAPPLE7's voice assistant script 2/17/16 - V0.2.0 alpha - Speech recognition added 2/25/16 - V0.3.0 alpha - Language parser from gtoal Released on 2/11/16 ----X-AI Initiative 2016----