Mi canal cambia de direccion web a -> https://www.youtube.com/c/JOSEOJEDAROJAS ahora mas accesible y facil de encontrar. #programacion #programando #code #programming #contabilidad, etc.
domingo, 16 de agosto de 2020
domingo, 2 de agosto de 2020
106 Python. Lee texto y convierte a audio.
Leer fichero de texto y pasarlo a fichero de audio usando #libreria #gTTS con #Python.
from gtts import gTTS def textoAudio(ficheroTexto, idioma, ficheroAudio): with open(ficheroTexto,"r") as fichero: texto = fichero.read() tts = gTTS(text=texto,lang=idioma) tts.save(ficheroAudio) print("He terminado de grabar el fichero de audio") textoAudio("texto.txt","ES","textoAudio.mp3")
sábado, 1 de agosto de 2020
105 Python. Captura audio y pasa a texto
Reconoce audio desde micro o fichero y lo pasa a texto, usando #libreria #SpeechRecognition con #Python
import speech_recognition as srr = sr.Recognizer()#desde microfonowith sr.Microphone() as recurso:print("Dime algo ... ")audio = r.listen(recurso)try:texto = r.recognize_google(audio,language='es-ES')print("Esto es lo que has dicho : {}".format(texto))with open("audio.wav","wb") as fichero:fichero.write(audio.get_wav_data())except:print("Lo siento no te entendi")#desde fichero audioimport timewith sr.AudioFile("audio.wav") as recurso:audio = r.listen(recurso)try:print("Leyendo fichero de audio...")texto = r.recognize_google(audio,language='es-ES')time.sleep(0.5)print(texto)except:print("Lo siento ha ocurrido un error")
Suscribirse a:
Entradas (Atom)