From 5cf120d0e57d7d02e09faf1827b6a3c3ac118a80 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Sat, 5 Mar 2022 15:41:16 -0500 Subject: [PATCH] Send raw bytes for us in sa.play_buffer --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ tts_tcp_stream.py | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d4b940c --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Learning Nemo Toolkit + +## Examples + +I made a streaming example with `tts_stream.py`. + +``` +python tts_steam.py +``` + +Will take some time to load but eventually you will see +``` +[NeMo I 2022-03-05 14:32:25 common:654] Instantiating model from pre-trained checkpoint +[NeMo I 2022-03-05 14:32:27 features:240] PADDING: 1 +[NeMo I 2022-03-05 14:32:27 features:249] STFT using conv +[NeMo I 2022-03-05 14:32:27 features:251] STFT using exact pad +[NeMo I 2022-03-05 14:33:13 modelPT:376] Model SqueezeWaveModel was successfully restored from /home/toor/.cache/torch/NeMo/NeMo_1.0.0rc1/tts_squeezewave/d48f5835ac007ddb0c183bdbbbdace28/tts_squeezewave.nemo. +File tts_fifo_file already exists +Pipe text to tts_fifo_file +``` + +You can echo text steams to this file and the program will process them and play them on local speaker: + +``` +echo "I can't let you do that Dave." > tts_fifo_file +``` + +The first time it processes a text stream it will take a lot longer. It should get slightly faster after that first steam. + +## Dependencies + +I had + +``` +llvmlite-0.36.0-cp38-cp38-linux_aarch64.whl +onnxruntime_gpu-1.7.0-cp38-cp38-linux_aarch64.whl +torch-1.7.0-cp38-cp38-linux_aarch64.whl +``` + +In a dependencies folder. So I assume I hade these installed in then virtualenv manually diff --git a/tts_tcp_stream.py b/tts_tcp_stream.py index 21b487e..6619e49 100644 --- a/tts_tcp_stream.py +++ b/tts_tcp_stream.py @@ -20,7 +20,7 @@ def send_file(audio_data): (HOST, PORT) = ('rospi.runcible.io', 9000) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) - s.sendfile(audio_data) + s.sendall(audio_data) def create_fifo(path):