Ok so ollama’s ChatResponse class allows, when creating an instance of it, to write stream = True.
So I could stream the outputted response directly into Piper TTS and into the speakers.
Except it would sound very weird, very robotic-like since the chatbot outputs tokens, not words. I then created a function called sentence_buffer() that seperates them into a list of words, that are then given to Piper TTS in speaker.py
Then I used a library called pyaudio to stream the Piper TTS output into the speakers! it’s actually just a Python wrapper for a C library called portaudio, so I ran into a LOT of dependency issues, but that’s a battle for another day.
Moved a few functions that were in main.py into other files for better management
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.