Introduction
Do you want your robot speak up? Or did your plants ever mentioned they are thirsty? The Speech Synthesis Shield for Arduino makes it easy come true. It is time to give a voice to your robots and projects. The Speech Synthesis Shield is designed to be easily stacked upon any standard Arduinos. It uses a XFS5051CE speech synthesis chip from IFLYTEK which combines world leading technology and high degree of integration. Languages such as Chinese and English are both supported, dialects such as Cantonese and mixed speech are also functional with this module. It is very funny to make a weather forecast with broadcast voice. It is using UART communication to make it widely compatible with most controller boards.
Specification
- Baud rate:4800,9600,57600,115200
- A busy indicator LED
- A power indicator LED
- Voltage:+5V
- Size:56*53mm
- Weight: 26 gram
- 11 levels of speaking speed
- Be able to speak Chinese
- Be able to speak English
- Both male and female voice supported
- Use the Serial ports of your Arduinos only
Get Started
Please press RST button on the controller board after uploaded the sketch, or it will affect the normal use. ** *Remember the "RST" button on the speech shield is only the speech synthesis chip. * **The busy led will be light once, when you press "RST".
Sample Code
#include <SpeechSynthesis.h>
void setup()
{
Serial.begin(9600);
}
byte ssr[500];//define a character string
void loop()
{
SpeechSynthesis.buf_init(ssr);//Clear the buffer
SpeechSynthesis.English(ssr,4,"5");//volume in grade 5
SpeechSynthesis.English(ssr,6,"cooki");//"6" means synthesis in English; "cooki"is the content
SpeechSynthesis.English(ssr,4,"5");
SpeechSynthesis.English(ssr,6,"cooki Clock, reset and supply management");
SpeechSynthesis.English(ssr,2,"10");
SpeechSynthesis.English(ssr,6,"cooki Clock, reset and supply management");
SpeechSynthesis.English(ssr,2,"5");//speed of speaking: grade 5
SpeechSynthesis.English(ssr,5," ");//speed,volume,intomation are all set into default
SpeechSynthesis.English(ssr,6,"cooki Clock, reset and supply management");
SpeechSynthesis.Espeaking(0,19,4,ssr);//Executive commands above, "0" is synthesis command; "19" select speaker; "4" speech function
while(Serial.read()!=0x41)//waiting synthesis complete
{}
while(Serial.read()!=0x4F)//waiting play complete
{}
SpeechSynthesis.buf_init(ssr);
SpeechSynthesis.English(ssr,6,"hello cooki 123");
SpeechSynthesis.Espeaking(0,19,4,ssr);
while(Serial.read()!=0x41)
{}
while(Serial.read()!=0x4F)
{}
SpeechSynthesis.buf_init(ssr);
SpeechSynthesis.English(ssr,6,"hello cooki 123");
SpeechSynthesis.Espeaking(0,19,7,ssr);
while(1);
}
Commands List with Library V2
Here is the NEW Speech Synthesis library V2, it fixed some bugs about the number synthesis.
A complete command is composed by three sections: Initialization Function, Speech Synthesis Function and Execute Function.
Initialization Function
SpeechSynthesis.buf_init(ssr);
It will clear all buffer on your board, and initialize chip setting.
Speech Synthesis Function
'''SpeechSynthesis.English(char sr[ ],byte cmd,char a[ ]); Description: 1、char sr[ ]-->the content which will be read by the module 2、byte cmd -->the command which will be sent to the module 3、char a[ ] -->the content
For Example:
SpeechSynthesis.English(ssr,4,"5"); //volume in grade 5
SpeechSynthesis.English(ssr,6,"cooki"); //"6" means synthesis in English; "cooki"is the content
Execute Function
SpeechSynthesisClass::Espeaking(byte cmda ,byte cmdb,byte cmdc,char c[]) Description: 1、char cmda-->Working mode 2、byte cmdb-->Select speaker 3、char cmdc-->Speaking Command format 4、char c[ ] -->the content
For Example: SpeechSynthesis.Espeaking(0,19,4,ssr); //"0" means command (speech synthesis command);"19" means the choice who to speak;"4" means the format of reading;"ssr" store the content.
char cmda
/*parameter value*/ meaning /*0*/ Speech Synthesis Command /*1*/ Stop Speech Synthesis Command /*2*/ Pause Speech Synthesis Command /*3*/ Resume Speech Synthesis Command /*4*/ Check Status /*5*/ Enter power-save mode
byte cmdb
/*parameter value*/ meaning /*0*/Men Voice:“I am XuJiu” /*1*/Men Voice:“I am XuDuo” /*2*/Women Voice:“I am XiaoPin” /*3*/Donald Duck Voice:“I am a Duck” /*4*/Girls Voice:“I am a girl” /*5*/Yong Woman Voice:“I am XuDuo” /*6*/Men Voice:“I am John”(English Only) /*7*/Women Voice:“I am Terry”(English Only) /*8*/Women Voice:“I am Catherine”(English Only) /*9*/~/*16*/ Chinese Dialect(If you are interested in this, you could try it one by one, it is very funny!) /*17*/Boys Voice:“I am John” /*18*/Girls Voice:“I am Lina” /*19*/Women Voice:“I am Robot”
char cmdc
/*parameter value*/ meaning
/*4*/123km Synthesised as:“one hundred and twenty three kilometres” /*6*/Words“you” Synthesised as:“y-o-u” /*7*/Words“you” Synthesised as:“you”
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.