Skip to content

Commit 8a9fc1e

Browse files
committed
Example for TTS
1 parent 76bdcfe commit 8a9fc1e

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Here are some examples:
118118

119119
- [streams-generator-webserver_wav](examples/streams-generator-webserver_wav) A Webserver which renders some generated sound
120120
- [streams-sam-webserver_wav](examples/streams-sam-webserver_wav) A Webserver which renders the result from the SAM TTS engine
121+
- [streams-tts-webserver_wav](examples/streams-tts-webserver_wav) A Webserver which renders the result from the SAM TTS engine
121122

122123
#### Logging
123124

@@ -146,6 +147,7 @@ Dependent on the example you might need to install some of the following librari
146147
- [arduino-fdk-aac](https://github.com/pschatzmann/arduino-fdk-aac) to encode or decode AAC
147148
- [Mozzi](https://github.com/pschatzmann/Mozzi) A sound synthesis library for Arduino
148149
- [SAM](https://github.com/pschatzmann/SAM) A Text to Speach Engine
150+
- [TTS](https://github.com/pschatzmann/TTS) A Text to Speach Engine
149151

150152
## Installation
151153

examples/streams-sam-webserver_wav/streams-sam-webserver_wav.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* @file experiment-sam-webserver.ino
3-
* @author Phil Schatzmann
2+
* @file streams-sam-webserver_wav.ino
43
*
54
* @author Phil Schatzmann
65
* @copyright GPLv3
76
*
87
*/
98
#include "sam_arduino.h"
9+
#include "AudioWAVServer.h"
1010

1111
using namespace audio_tools;
1212

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Using SAM Speach to Text
2+
3+
I am providing a simple sketch which generates sound data with the TTS text to speach engine.
4+
You need to install https://github.com/pschatzmann/TTS
5+
6+
In this demo we provide the result as WAV stream which can be listened to in a Web Browser
7+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @file streams-tts-webserver_wav.ino
3+
*
4+
* @author Phil Schatzmann
5+
* @copyright GPLv3
6+
*
7+
*/
8+
#include "TTS.h"
9+
#include "AudioWAVServer.h"
10+
11+
using namespace audio_tools;
12+
13+
AudioWAVServer server("ssid","password");
14+
15+
// Callback which provides the audio data
16+
void outputData(Stream &out){
17+
Serial.print("providing data...");
18+
TTS tts(out);
19+
tts.sayText("Hallo, my name is Alice");
20+
}
21+
22+
void setup(){
23+
Serial.begin(115200);
24+
//AudioLogger::instance().begin(Serial, AudioLogger::Debug);
25+
// start data sink
26+
TTSInfo info = TTS::getInfo();
27+
server.begin(outputData, info.sample_rate, info.channels, info.bits_per_sample);
28+
}
29+
30+
31+
// Arduino loop
32+
void loop() {
33+
// Handle new connections
34+
server.doLoop();
35+
}

0 commit comments

Comments
 (0)