Skip to content

Commit 6333d0b

Browse files
committed
espeak-ng examples
1 parent 119f632 commit 6333d0b

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Dependent on the example you might need to install some of the following librari
134134
- [TTS](https://github.com/pschatzmann/TTS) A Text to Speech Engine
135135
- [flite](https://github.com/pschatzmann/arduino-flite) A Text to Speech Engine
136136
- [simple-tts](https://github.com/pschatzmann/arduino-simple-tts) A Simple TTS engine using prerecorded audio (e.g. to implement Talking Clock, Talking Numbers)
137+
- [espeak-ng](https://github.com/pschatzmann/arduino-espeak-ng) eSpeak NG is an open source speech synthesizer that supports more than hundred languages.
137138
- [arduino-stk](https://github.com/pschatzmann/Arduino-STK) Synthesis ToolKit in C++ (STK)
138139
- [Maximilian](https://github.com/pschatzmann/Maximilian) cross-platform and multi-target audio synthesis and signal processing library
139140
- [Mozzi](https://github.com/pschatzmann/Mozzi) A sound synthesis library for Arduino
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* @file espeak-min.ino
3+
* @author Phil Schatzmann
4+
* @brief Arduino C++ API - minimum example. The espeak-ng-data is stored on in
5+
* progmem with the arduino-posix-fs library and we output audio to I2S with the
6+
* help of the AudioTools library
7+
* @version 0.1
8+
* @date 2022-10-27
9+
*
10+
* @copyright Copyright (c) 2022
11+
*/
12+
13+
#include "AudioTools.h" // https://github.com/pschatzmann/arduino-audio-tools
14+
#include "AudioLibs/AudioKit.h" // https://github.com/pschatzmann/arduino-audiokit
15+
#include "FileSystems.h" // https://github.com/pschatzmann/arduino-posix-fs
16+
#include "espeak.h"
17+
18+
AudioKitStream i2s;
19+
ESpeakPROGMEM espeak(i2s);
20+
21+
void setup() {
22+
Serial.begin(115200);
23+
//file_systems::FSLogger.begin(file_systems::FSInfo, Serial);
24+
25+
// setup espeak
26+
espeak.begin();
27+
28+
// setup output
29+
audio_info espeak_info = espeak.audioInfo();
30+
auto cfg = i2s.defaultConfig();
31+
cfg.channels = espeak_info.channels; // 1
32+
cfg.sample_rate = espeak_info.sample_rate; // 22050
33+
cfg.bits_per_sample = espeak_info.bits_per_sample; // 16
34+
i2s.begin(cfg);
35+
36+
}
37+
38+
void loop() {
39+
espeak.say("Hello world!");
40+
delay(5000);
41+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* @file espeak-min.ino
3+
* @author Phil Schatzmann
4+
* @brief Arduino C++ API - minimum example. The espeak-ng-data is stored on in
5+
* progmem with the arduino-posix-fs library and we output audio to I2S with the
6+
* help of the AudioTools library
7+
* @version 0.1
8+
* @date 2022-10-27
9+
*
10+
* @copyright Copyright (c) 2022
11+
*/
12+
13+
#include "AudioTools.h" // https://github.com/pschatzmann/arduino-audio-tools
14+
#include "FileSystems.h" // https://github.com/pschatzmann/arduino-posix-fs
15+
#include "espeak.h"
16+
17+
I2SStream i2s; // or replace with any other audio sink
18+
ESpeakPROGMEM espeak(i2s);
19+
20+
void setup() {
21+
Serial.begin(115200);
22+
//file_systems::FSLogger.begin(file_systems::FSInfo, Serial);
23+
24+
// setup espeak
25+
espeak.begin();
26+
27+
// setup output
28+
audio_info espeak_info = espeak.audioInfo();
29+
auto cfg = i2s.defaultConfig();
30+
cfg.channels = espeak_info.channels; // 1
31+
cfg.sample_rate = espeak_info.sample_rate; // 22050
32+
cfg.bits_per_sample = espeak_info.bits_per_sample; // 16
33+
i2s.begin(cfg);
34+
35+
}
36+
37+
void loop() {
38+
espeak.say("Hello world!");
39+
delay(5000);
40+
}

0 commit comments

Comments
 (0)