How do I transfer the output from pyttsx3 to a variable for DSP

426 views Asked by At

I'm running a Raspberry Pi4 with Python 3.7 and pyttsx3.

I'm planning to use pyttsx3 to verbally respond to "commands" I issue. I also plan to visualise the output speech on a neopixel strip (think "Close Encounters" on a miniature scale.) The visualisation is not the problem though.

My problem is, how do I get the output from pyttsx3 into a variable so I can pass it to my DSP?

I know that I can pass the to a file:

import pyttsx3
engine = pyttsx3.init() # object creation
"""Saving Voice to a file"""
engine.save_to_file('Hello World', 'text.mp3')
engine.runAndWait()

& I know I can read the file but that creates a latency.

I want the speech and twinkly lights to coincide and I know I can play the wav file but I'd like something more "real time".

Does anyone have any suggestions please?

0

There are 0 answers