Monday, April 11, 2016

Text to Speech on arduino

Give your project a voice! Without Text-to-Speech Module, Arduino TTS library makes it possible, voice synthesizer that converts a stream of digital text into retro (robot) speech. Its simple needs only external LM385 amplifier with arduino Uno, No special components or shields required. Thanks to Gabriel Petrut and Clive Webster for making this thing.
Application Ideas:
  • Reading Internet-based data streams (such as e-mails or Twitter feeds)
  • Conveying status or sensor results from robots, scientific equipment, or industrial machinery
  • Language learning or speech aids for educational environments

Components required:
1. Arduino Uno
2. LM386
3. Speaker
4. Capacitors and few resistors as shown in circuit

Step: 1 Circuit Diagram

Text to Speech arduino (TTS)

Step: 2 Library download





Step: 3 Sample Code

This program and library works only with Arduino 1.0 version

Program:
/*
  Text To Speech syntesis library
  Copyright (c) 2008 Clive Webster.  All rights reserved.
  Nov. 29th 2009 - Modified to work with Arduino by Gabriel Petrut.
*/

/*
  The Text To Speech library uses Timer1 to generate the PWM
  output on digital pin 10. The output signal needs to be fed
  to an RC filter then through an amplifier to the speaker.
*/

#include <TTS.h>

// Media pins
#define ledPin 13       // digital pin 13                          

// Variables
char text [50];
boolean state=0;

TTS text2speech;  // speech output is digital pin 10

void setup() { 
  //media
  pinMode(ledPin, OUTPUT); 
}

//================================================================
// Main Loop
//================================================================
void loop(){
    state = !state;
    digitalWrite(ledPin, state);
    Test_Speech();
    delay(1000);          // delay a second
}  
//================================================================


void Test_Speech() {
 text2speech.setPitch(6); //higher values = lower voice pitch
 strcpy(text, "Hello  master! How are you doin?");
 text2speech.say(text);
 delay(500);
 text2speech.setPitch(1); //lower values = higher voice pitch
 strcpy(text, "I am fine, thankyou.");
 text2speech.say(text);
}


Step: 4 Test your creation

For more interesting projects click here

Arduino now speak what you have given to speak.....enjoy
for queries and questions please comment..


7 comments:

  1. existe versión de esta librería que convierta a castellano?

    ReplyDelete
  2. iam getting any error for TTS text2speech;
    where u declared TTS

    ReplyDelete
    Replies
    1. Have you downloaded library? It work only on older version of arduino 1.0 or older

      Delete
  3. i am getting error for WProgram.h, please give me solution

    ReplyDelete