domingo, 16 de agosto de 2020

Cambio de direccion web en canal Youtube

 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, 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 sr

r = sr.Recognizer()
#desde microfono
with 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 audio
import time
with 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")