-
Notifications
You must be signed in to change notification settings - Fork 6
Using a Foreign Language And Voice Options
Phil Schatzmann edited this page Nov 18, 2022
·
2 revisions
Using a foreign language is very easy. You just need to load the language dependent files and set the corresponding voice:
#include "AudioTools.h" // https://github.com/pschatzmann/arduino-audio-tools
#include "FileSystems.h" // https://github.com/pschatzmann/arduino-posix-fs
#include "espeak.h"
I2SStream i2s; // or replace with AudioKitStream for AudioKit
const bool load_english = false;
ESpeak espeak(i2s, load_english);
void setup() {
Serial.begin(115200);
// add foreign language configuration file
espeak.add("/mem/data/de_dict", espeak_ng_data_de_dict,espeak_ng_data_de_dict_len);
espeak.add("/mem/data/lang/de", espeak_ng_data_lang_gmw_de, espeak_ng_data_lang_gmw_de_len);
// add an optional voice
espeak.add("/mem/data/voices/!v/Alicia", espeak_ng_data_voices__v_Alicia, espeak_ng_data_voices__v_Alicia_len);
// setup espeak
espeak.begin();
// Set voice and voice option
espeak.setVoice("de+Alicia");
// setup output
audio_info espeak_info = espeak.audioInfo();
auto cfg = i2s.defaultConfig();
cfg.channels = espeak_info.channels; // 1
cfg.sample_rate = espeak_info.sample_rate; // 22050
cfg.bits_per_sample = espeak_info.bits_per_sample; // 16
i2s.begin(cfg);
}
void loop() {
espeak.say("Hallo Welt!");
delay(5000);
}
Here is the list of all language configuration files that are available.