我正在试着做一个西班牙语语音助手。我不知道如何使用if、elif和else创建案例。 if texto == nada:
engine.say("Ok estare para ti cuando me necesites")
engine.runAndWait()
elif texto == notenecesito:
engine.say("Ok estare para ti cuando me necesites")
engine.runAndWait()
elif
我试着像这样导入:
sample_wave是另一个python文件,onlistener是类名,onpartialTranscript是其中的函数
from sample_wave import onPartialTranscript
如何从另一个文件中调用类中的函数?
def create_username():
username, pwd
try:
engine.say("Enter the user name and password for New user")
engine.runAndWait()
我有一个脚本,它使用Python语言的speech_recognition中内置的IBM Speech to Text API。它非常慢。回复时间大约是5秒。我怀疑while True循环会导致CPU耗尽,但我不知道。
代码如下:
import speech_recognition as sr
import pyttsx
import time
import requests
engine = pyttsx.init()
time_check = time.strftime("%H")
time_check = int(time_check)
# current weat
我编写了一个程序,它是python中的一个机器人,它响应您的命令。它使用谷歌语音识别。我想为它制作一个带有tkinter的gui,但是当我运行程序时,tkinter窗口没有打开。tkinter程序应该在窗口中显示您自己的消息和机器人的响应。这是我的密码
from cgitb import text
from multiprocessing.connection import answer_challenge
from turtle import goto
from typing import Text
from urllib import response
import speech_reco
下面的程序给了我一个错误。这是我的节目:
import pyttsx3 as tts
def speak(text):
engine = tts.init("sapi5")
engine.say(text)
engine.runandwait()
speak('Hello user this is a test message.')
这是我收到的错误消息:
Traceback (most recent call last):
File "c:\Users\SIDDHESH\Projects\test.py", li
我想写一个脚本,当它将单词打印到屏幕上时,它将读取单词列表。
import pyttsx
engine = pyttsx.init()
words = ["here","are","some","test","words"]
for i in words:
engine.say(i)
print i
engine.runAndWait()
然而,在运行上述操作时,除“这里”以外的所有其他单词都会被剪短。我听到这样的声音:“暂停一下阿苏特沃--”
如果我取消了engine.runAndWa
我得到了上面的异常。谁能帮我找出原因。这是我的代码:
import pyttsx3 # pip install pyttsx3
engine = pyttsx3.init() # creating a variable named engine
#engine.say('Hello World...!') #calling that function
#engine.runAndWait() #it is also a pre build funtion used to run and wait till funtion is completed
我试着做一个助手,但是当用户想要播放一首歌时,它会一直播放到结束。当用户按下一个键时,我希望它停止。对于engine.say()也是一样的。
我想不出办法来打断他们的文件。这里有engine.stop() for pyttsx3,但我无法让它工作。我想可能是因为engine.runAndWait(),但是如果我不包括它,机器就什么都不说了。我怎样才能解决这些问题?如果有解决这个问题的方法,我也可以尝试使用另一个模块。
import pyttsx3
from playsound import playsound
if "play" in input:
songName
import speech_recognition as sr
import pyttsx3
import datetime
r = sr.Recognizer()
mic = sr.Microphone()
engine = pyttsx3.init()
engine.setProperty('rate',120) #75 words per minute
engine.setProperty('volume',0.9) #loudness of speaker
def getTime():
str((datetime.datetime.now(
我已经开始开发我自己的虚拟助手了。这在几天前工作得很好,但我相信我搞砸了。它应该找出我输入的命令,然后响应,但它总是显示'greeting'-response。 from time import ctime
import time
import os
import requests, json
import random
import pyttsx3
engine = pyttsx3.init()
startup = ["Starting Ares...", "Booting up Ares..."]
selected_startup
engine = pyttsx.init()
voices = engine.getProperty('voices')
for voice in voices:
engine.setProperty('voice', voice.id)
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
我尝试了原始文档中的for循环,但我的机器上只有一个声音。如何下载更多语音?
我试着用python和python电报- bot包构建一个电报机器人,现在我尝试向用户发送一个语音命令。
我的代码就像
def start(update, context):
engine = pyttsx3.init()
engine.save_to_file('welcome to this bot', 'voice.mp3')
engine.runAndWait()
#return update.message.reply_text('hi i am bot with your friend')
生成mp3文件,然后如何将该语音文件发送给
我使用pyttsx3和speech_recognition包为Python3接收用户的语音输入。但是,如果用户没有提供任何语音输入,在超时之后,用户必须手动输入呢?请帮我拿这东西!
import pyttsx3
import speech_recognition as sr
import pyjokes
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
r = sr.Recognizer()
user_jokes = "Set a range in number..
我在做什么:
我试图运行一个简单的tts程序:
import pyttsx3
*** engine = pyttsx3.init()
engine.setProperty("rate", 178)
engine.say("I am the text spoken after changing the speech rate.")
engine.runAndWait()
但是,我在*行中得到了以下错误:
Exception has occurred: ModuleNotFoundError No module named 'win32api'
我
我正在制作一个pyttsx3聊天机器人,但是发生了这个错误:
OSError: libespeak.so.1: cannot open shared object file: No such file or directory
还发生了此错误:
KeyError: None
下面是我的代码:
import pyttsx3
def say(sp):
engine = pyttsx3.init()
engine.say(sp)
engine.runandwait()
say("Hello my name is Neuron")
有人知道我怎么解决
每当我运行这段代码并告诉启动函数"google“时,它就会返回到另一个函数。我已经试了几天了,但还是没有运气。如能提供任何帮助,将不胜感激:)
import webbrowser
import string
import time
import pyttsx3
import speech_recognition as sr
engine = pyttsx3.init()
r = sr.Recognizer()
def Listen():
with sr.Microphone() as sourceL:
print("Listening...")