Speech synthesis and recognition for p5.js
DownloadWeb Audio Speech Synthesis and Speech Recognition Implementation for p5.js (http://p5js.org)
R. Luke DuBois (dubois@nyu.edu)
ABILITY Project / Integrated Design & Media
NYU
p5.speech is a simple p5 extension to provide Web Speech (Synthesis and Recognition) API functionality. It consists of two object classes (p5.Speech and p5.SpeechRec) along with accessor functions to speak and listen for text, change parameters (synthesis voices, recognition models, etc.), and retrieve callbacks from the system.
Speech recognition requires launching from a server using HTTPS (e.g. using a python server on a local machine… a ‘file’ URI won’t work).
<script src="https://cdn.jsdelivr.net/gh/IDMNYU/p5.js-speech@0.0.3/lib/p5.speech.js"></script>
var foo = new p5.Speech(); // speech synthesis object
foo.speak('hi there'); // say something
var foo = new p5.SpeechRec(); // speech recognition object (will prompt for mic access)
foo.onResult = showResult; // bind callback function to trigger when speech is recognized
foo.start(); // start listening
function showResult()
{
console.log(foo.resultString); // log the result
}
constructor
methods
properties
constructor
methods
properties