KoljaB / RealtimeTTS

Converts text to speech in realtime
1.41k stars 120 forks source link

error in play() with engine system: [Errno -9996] Invalid output device (no default output device) #32

Open BookerShi opened 5 months ago

BookerShi commented 5 months ago

from RealtimeTTS import TextToAudioStream, SystemEngine, AzureEngine, ElevenlabsEngine

engine = SystemEngine() # replace with your TTS engine

import ipdb;ipdb.set_trace()

stream = TextToAudioStream(engine) stream.feed("Hello world! How are you today?") print(f"type:{type(stream)}") print(f"stream:{stream}")

stream.play_async()

stream.play()

error in play() with engine system: [Errno -9996] Invalid output device (no default output device)

How can such problems be solved and what causes them

BookerShi commented 5 months ago

I checked my computer, and the sound card drivers are all intact

KoljaB commented 5 months ago

Sounds like a pyttsx3 can't detect your output device.

Pls run some basic example code like this to verify:

import pyttsx3 
engine = pyttsx3.init()
engine.say("hello")
engine.runAndWait()
endomorphosis commented 5 months ago

I was unable to run this headless, I made some changes to fix the dependency issues in ubuntu 20.04, ubuntu22.04

https://github.com/hallucinate-ai/RealtimeTTS/tree/master @KoljaB

alibabadoufu commented 3 months ago

Sounds like a pyttsx3 can't detect your output device.

Pls run some basic example code like this to verify:

import pyttsx3 
engine = pyttsx3.init()
engine.say("hello")
engine.runAndWait()

I am having the same issue. After running the code suggested, I got this:

ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:852: audio open error: No such file or directory
KoljaB commented 3 months ago

I am not good with linux, but maybe it might help if you try to install espeak, ffmpeg and libespeak1 as shown below:

sudo apt update && sudo apt install espeak ffmpeg libespeak1

TerryWong1024 commented 3 months ago

I am not good with linux, but maybe it might help if you try to install espeak, ffmpeg and libespeak1 as shown below:

sudo apt update && sudo apt install espeak ffmpeg libespeak1

@alibabadoufu Does this method resolve your problem?

alibabadoufu commented 3 months ago

No it doesn't. I guess because the server doesn't allow to connect with the sound card so it doesn't work for me.