python - Pyttxs3 文件中的 JackShmReadWritePtr 错误

标签 python pyttsx

import pyttsx3
engine = pyttsx3.init() # object creation

""" RATE"""
rate = engine.getProperty('rate')   # getting details of current speaking rate
print (rate)                        #printing current voice rate
engine.setProperty('rate', 125)     # setting up new voice rate


"""VOLUME"""
volume = engine.getProperty('volume')   #getting to know current volume level (min=0 and max=1)
print (volume)                          #printing current volume level
engine.setProperty('volume',1.0)    # setting up volume level  between 0 and 1

"""VOICE"""
voices = engine.getProperty('voices')       #getting details of current voice
#engine.setProperty('voice', voices[0].id)  #changing index, changes voices. o for male
engine.setProperty('voice', voices[1].id)   #changing index, changes voices. 1 for female

engine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.runAndWait()
engine.stop()

我正在使用 pyttsx3 库来创建我正在制作的聊天机器人,并且我在单独的文件上运行了此测试,现在遇到了错误...

200
1.0
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib setup.c:547:(add_elem) Cannot obtain info for CTL elem (MIXER,'IEC958 Playback Default',0,0,0): No such file or directory
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( outputParameters, hostApi, StreamDirection_Out )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1846
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)
wave_open_sound > Pa_OpenStream : err=-9996 (Invalid device)

我研究了如何解决这个问题,但我无法理解每个人在说什么,那么我该如何解决这个问题?谢谢! ...................................................... ...................................................... ...................................................... ...................................................... ...................................................... ......(这是为了反对我无法在没有太多文字的情况下发布那么多代码)

最佳答案

该错误表明jack 服务器存在问题。首先,我会尝试重新启动音频系统并查看它是否有效:

pulseaudio --kill  
jack_control start
jack_control exit  
pulseaudio --start

如果jackd不会死,就杀死它。

关于python - Pyttxs3 文件中的 JackShmReadWritePtr 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59148592/

相关文章:

python - 从 C++ 停止嵌入式 Python 提示

python - 如何对新加载的网页进行截图

python文本到语音使用pyttsx

Python-类型错误 : listen() missing 1 required positional argument: 'self'

python - 在 Linux Mint 上安装 pyttsx3

python - 无法在 Ubuntu Linux 16 上的 Python 2.7 中导入 pyttsx

python - 导入 csv 时 Cassandra 错误 'NoneType' 对象没有属性 'datacenter'

Python SQLalchemy 表的多个字段

python - EOFError 在使用 PYTTSX 时随机出现,我的代码现在不断抛出此错误?几个小时前它工作得很好

python - 如何使用 selenium python 抓取雅虎财经搜索自动建议结果?