So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Kamal_1207
#96275 The library works well with an arduino nano, but I cant get it to work with the NodeMCU 1.0 esp8266. The library converts text into phenomes which is produced as audio using PWM signals. The github page of the library 2 does mention in its readme that it supports esp8266.
Here is the github page https://github.com/jscrane/TTS

## Supported Hardware

- ATmega328-based Arduinos (e.g., Uno, Pro, Pro Mini, etc.): pins 3, 9, 10
-ESP8266: pins 0 to 16 (with analogWrite())


(It does support others too, but I've mentioned only these)

what do I need to change in the code?
Here is the example code which worked for the nano. changing just the PIN number to the appropriate number of the esp8266 according to its pinout did not work.
Code: Select all#include <TTS.h>

// Media pins
#define PIN 3
//#define LED 13                         

TTS text2speech(PIN);  // default is digital pin 10

void setup() {
 // pinMode(LED, OUTPUT);
}

void loop() {
 // digitalWrite(LED, !digitalRead(LED));

  text2speech.setPitch(6);
  text2speech.sayText("Hello  master! How are you doin?");
  delay(500);

  text2speech.setPitch(1);
  text2speech.sayText("I am fine, thankyou.");

  delay(1000);
User avatar
By Kamal_1207
#96298
rooppoorali wrote:Here is an alternative library that you can use: https://github.com/horihiro/esp8266-google-tts

I did consider this, but I am still a bit of a newbie, so did not understand how to use it. My project involves some weather sensors and a speaker which tells you the weather when asked. I did not know where to connect the speaker to the esp nor did i know how to even use the library in the first place.