Project Description - alan4186/Speakjet-Interface GitHub Wiki

This section describes the work I did to create a library for the SpeakJet. The [getting started](getting started guide) page describes how to connect the SpeakJet with the Arduino as well as how to use the library in your own sketches.

Original Code Base

The Original Code base of the SpeakJet chip consists of a dicionary of words and an demo sketch for playing hard coded phrases. The dicionary of words is formatted as a list of key-value pairs in plain text where the keys are a given word and the values are a list of commands to produce the word with the SpeekJet chip. The demo sketch from Sparkfun is for an arduino shield with the SpeakJet chip on it called the 'voice box'. The sketch requires that the SpeakJet chip is connected the way same way it is on the voice box.

Added Value

The SpeakJet seems to be designed for interfacing with a PC rather than a microcontroller given that the example software provieded by the manufacure is exclusevly for windows. The only arduino code provided is for the voice box shield, which has been retired by Sparkfun. Because no usefull code base existed for arduino I decided to create a simple library that will make producing phrases easier. My library has a few H files named speakjetLib.h, pinout.h, commands.h and wordCmds.h. Below is a description of each file.

speakjetLib.h

This file just includes the other files so only one #include statement is needed in the arduino sketch. The statement #include speakjetLib.h should be placed near the top of your sketch to use this library.

pinout.h

This file defines the connections between the Arduino and the SpeakJet. There is a #define statement for each connection. These some of these values can be changed to fit a user's needs.

commands.h

This file defines all of the commands for the SpeakJet in a human readable form. The phoneme commands are defined as the phonemes they represent rather than an arbitrary character or integer. The commands and their actions were collected from the data sheet and placed in the H file. The other commands are also in a human readable form, for instance the command to increase the speed of speech is defined as FAST.

wordCmds.h

This file instantiates the words from the SpeakJet's dictionary as constant character arrays of commands. The variable names for each of the words starts with an underscore to prevent conflicts with keywords or other variable names a programmer may use. The compiler will exclude any variables that are not used by the program so all 1400 words are instantiated but only the ones the program needs will be stored in memory, this allows the library to fit in the Arduino Uno's memory.