As you might know from my last posts I am currently extending my Arduino Audio Tools library to support the AI Thinker Audio Kit which is based on the ES8388 audio chip.
.

I thought it might be helpful to have a ‘Text to Speech’ example for the Audio Kit. In this example I am using FLITE.

Audio Kit

The Arduino Sketch

#include "flite_arduino.h"
#include "AudioTools.h"
#include "AudioDevices/ESP32AudioKit/AudioKit.h"

using namespace audio_tools;

AudioKitStream kit;
Flite flite(kit);

const char* alice = "Hallo my name is FLITE";

void setup(){
  Serial.begin(115200);

  auto cfg = kit.defaultConfig();
  cfg.bits_per_sample = 16;
  cfg.channels = 1;
  cfg.sample_rate = 8000;
  kit.begin(cfg);

  flite.say(alice);
}

void loop() {
}

When we define Flite, we assign the kit as output stream. Then we need to define the proper I2S parameters that Flite is expecting in the setup method! The audio autput is started by calling the say method.

Dependencies

You need to install the following libraries:

Source Code

The source code for this example can also be found on Github. Please note that this example was working at the time of publishing. If you want to try it out please use this (potentially updated) example.

Dependencies

You need to install the following libraries:


1 Comment

Jean-Luc · 8. December 2021 at 17:10

Aaah nice ! I love it
Next : how to have Flite speaks German !

Leave a Reply

Avatar placeholder

Your email address will not be published.