Skip to content

Instantly share code, notes, and snippets.

@Emgicraft
Created August 31, 2021 20:18
Show Gist options
  • Save Emgicraft/0afe8ab55b954caa9b6f28355b66ba01 to your computer and use it in GitHub Desktop.
Save Emgicraft/0afe8ab55b954caa9b6f28355b66ba01 to your computer and use it in GitHub Desktop.
Transcribe el contenido de una archivo de audio a texto. Soporta hasta audios de 5 minutos.
"""
Audio a texto.
El tipo de archivo tiene que ser .wav
@author: Magh
"""
import speech_recognition as sr
r = sr.Recognizer()
#r.energy_threshold = 300
#Archivo de audio de ejemplo:
audio = sr.AudioFile("AUDIO 1UNIDAD 3.wav")
with audio as source:
audio = r.record(source, duration=48.0) # duración: 48s
resultado = r.recognize_google(audio_data=audio, language="en-US") # idioma: inglés-US
print(resultado) # Muestra el texto procesado del audio.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment