SimpleSpeech – Processing Library
SimpleSpeech is a Processing Library for Speech Synthesis and Speech Recognition, based on the great work by Bryan Chung.
I upgraded and extended Byan’s original library to make it Processing 2.x / 3.x compatible and added some new functionality.
The library has been tested up to version 3.4.
It’s a wrapper for the Java libraries:
Download
Click HERE to download the latest version (10/23/2018).

Usage
Download and install the SimpleSpeech library in your processing / libraries folder.
Simple example for the Speech Synthesizer (A Processing sketch):
// IMPORT THE LIBRARY
import simpleSpeech.*;
// SPEAKER
Speak speaker;
void setup() {
speaker = new Speak(this, "kevin16");
speaker.speak("Hello World!");
] // setup()
Simple example for the Speech Recognizer:
// IMPORT THE LIBRARY
import simpleSpeech.*;
// LISTENER
Listen listener;
void setup() {
listener = new Listen(this, "\\sample.config.xml");
} // setup()
void draw() {
} // draw()
void listenEvent(Listen _l) {
String s = _l.readString();
if (s != null) {
if (s.equals("hello")) println("I recognized HELLO!");
} // if (s != null)
} // listenEvent()
Grammar
The grammar (Java Speech Grammar Format, JSGF) for the recognition is defined in the file sample.gram (in the data folder of your sketch).
Example of the grammar file:
grammar sample; public <command> = <word> | <color> | <shape>; <word> = (hello) <color> = (red | blue | green | yellow); <shape> = (circle | square);
Speech Recognition Configuration
The configuration for the Speech Recognition in deis stored in a file called sample.config.xml in the data folder of your sketch.
IMPORTANT:
Make sure the location of your grammar file is pointing to your data folder in sample.config.xml!
<!-- ******************************************************** -->
<!-- The Grammar configuration -->
<!-- ******************************************************** -->
<component name="jsgfGrammar" type="edu.cmu.sphinx.jsapi.JSGFGrammar">
<property name="dictionary" value="dictionary"/>
<property name="grammarLocation" value="file:///D:\Dropbox\Processing\processing%20rvg%20libs\simpleSpeech\examples\listener\data"/>
<property name="grammarName" value="sample"/>
<property name="logMath" value="logMath"/>
</component>