Utilizando o playsound,
não consegui resposta
from gtts import gTTS
import playsound
import os
#Configurações e credenciais na googleCloud
hotword = 'maguma'
with open('magu-assistente-8a63434b86c7.json') as credenciais_google:
credenciais_google = credenciais_google.read()
########FUNÇÕES PRINCIPAIS###############
def monitoria_audio():
microfone = sr.Recognizer()
with sr.Microphone() as source:
while True: #criando loop
print("Aguardando o comando:")
audio = microfone.listen(source)
try:
trigger = microfone.recognize_google_cloud(audio, credentials_json = credenciais_google, language='pt-BR')
trigger = trigger.lower()
if hotword in trigger:
print('Comando: ', trigger)
responde('feedback')
####executar os comandos
break
except sr.UnknownValueError:
print("Google Cloud Speech could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Cloud Speech service; {0}".format(e))
return trigger
def responde(arquivo):
playsound('C:/Users/ADM/minhaenv/audios/'+ arquivo +'.mp3')
monitoria_audio()
Aguardando o comando:
Could not request results from Google Cloud Speech service; <HttpError 403 when requesting https://speech.googleapis.com/v1/speech:recognize?alt=json returned "This API method requires billing to be enabled. Please enable billing on project #71025766865 by visiting https://console.developers.google.com/billing/enable?project=71025766865 then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry.". Details: "[{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developers console billing', 'url': 'https://console.developers.google.com/billing/enable?project=71025766865'}]}, {'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'BILLING_DISABLED', 'domain': 'googleapis.com', 'metadata': {'consumer': 'projects/71025766865', 'service': 'speech.googleapis.com'}}]">