Merging eSpeak With the Scribbler 2 Robot
The eSpeakPackage implement a useful capability in which a program may speak text to the user. The eSpeakPackage.h provides a library for output as spoken text just as C provides the stdio.h library for input and output. Users are able to execute Scribbler testing with eSpeak by reference the MyroC library and eSpeak library.
Getting Started
The following is a list of eSpeak commands users can put in their scribbler program.
-
eSpeakConnectestablishes connection with the eSpeak library. -
eSpeakTalktakes a string as parameter and create audio through the computer speakers. -
eSpeakSetGendertakes the string male or female to set the appropriate gender. -
eSpeakDisconnectdisconnect from the the eSpeak library.
Details of these functions are given in the header file, eSpeakPackage.h
A Simple Example
A simple example, eSpeakExample1.c, illustrates in the following program; steps for compiling and running the code follow the program listing. (Note that the make assumes the installation of a proper Makefile, as described in the lab on linux basics.)
/** This test demonstrate the basic text-to-speech capability of eSpeak
*
* Author: Jordan Yuan (2 Oct 2013)
* Revised by Jerod Weinman (20 Jan 2015)
*/
/* Compile this program with the line
* gcc -lMyroC -leSpeakPackage -o eSpeakExample1 eSpeakExample1.c
* or
* make eSpeakExample1
*/
#include "eSpeakPackage.h"
int main ()
{
eSpeakConnect ();//connect to eSpeakSpeak
//voice set randomly to female or male
eSpeakTalk( "setting up testing environment");
eSpeakTalk( "setting voice to female");
eSpeakSetGender ("female");
eSpeakTalk("Once upon a time in a kingdom far far away");
eSpeakSetGender("male");
eSpeakTalk("there was a little princess");
eSpeakTalk("who loves to stare into the stars");
eSpeakSetGender("female");
eSpeakTalk("one day a big dragon swooped down and they became the best of friends");
eSpeakSetGender("male");
eSpeakTalk("The end");
eSpeakDisconnect ();//disconnect from eSpeak
} //end of main
eSpeak together with MyroC and a Scribbler 2 Robot
Programming a Scribbler 2 robot presents challenges in testing, because regular testing requires the programmer to look at both the robot and code at the same time.
The eSpeak library provides a capability to resolve this problem of testing, because the eSpeakPackage allows you to look at the robot while the program speaks the intended robot action.
The program eSpeakExample2.c demonstrates the full capability of eSpeak with MyroC.
