p5.speech

Speech synthesis and recognition for p5.js

View the Project on GitHub

Download
Examples
Reference

p5.speech

Web 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).

Download

Include from a CDN

<script src="https://cdn.jsdelivr.net/gh/IDMNYU/p5.js-speech@0.0.3/lib/p5.speech.js"></script>

Examples

Simple Example (Synthesis)

var foo = new p5.Speech(); // speech synthesis object
foo.speak('hi there'); // say something

Simple Example (Recognition)

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
}

More Examples

Reference

p5.Speech

constructor

methods

properties

p5.SpeechRec

constructor

methods

properties