This commit is contained in:
2026-02-12 21:00:02 -08:00
parent cb1f2b0efd
commit 40714a3a68
1141 changed files with 1010880 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
# Simple TTS to A2DP
This is just an adaptation of the [streams-simple_tts-i2s example](https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-tts/streams-simple_tts-i2s) where the output stream has been replaced with a A2DPStream.
So the output goes to a Bluetooth Speaker!
More examples can be found at https://github.com/pschatzmann/arduino-simple-tts/tree/main/examples
Because we need a lot of progmem, do not forget to set the partition scheme to Huge APP!
### Dependencies
- https://github.com/pschatzmann/ESP32-A2DP.git
- https://github.com/pschatzmann/arduino-simple-tts
A word of warning: The A2DP output has it's challenges, so I do not recommend this as your first sketch.

View File

@@ -0,0 +1,57 @@
/**
* @file streams-tts-a2dp.ino
* @author Phil Schatzmann
* @copyright GPLv3
*
*/
#include "AudioTools.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
#include "AudioTools/Communication/A2DPStream.h"
#include "SimpleTTS.h"
const char* name = "LEXON MINO L"; // Replace with your device name
AudioInfo from(24000, 1, 16); // TTS
AudioInfo to(44100, 2, 16); // A2DP
NumberToText ntt;
A2DPStream a2dp;
FormatConverterStream out(a2dp);
MP3DecoderHelix mp3;
AudioDictionary dictionary(ExampleAudioDictionaryValues);
TextToSpeech tts(ntt, out, mp3, dictionary);
int64_t number = 1;
void setup(){
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
Serial.println("Starting...");
// setup conversion to provide stereo at 44100hz
out.begin(from, to);
// setup a2dp
auto cfg = a2dp.defaultConfig(TX_MODE);
cfg.name = name;
cfg.silence_on_nodata = true; // allow delays with silence
a2dp.begin(cfg);
a2dp.setVolume(0.3);
Serial.println("A2DP Started");
}
void loop() {
// speach output
Serial.print("Providing data: ");
Serial.println(number);
ntt.say(number);
number +=1;
delay(1000);
}