Mulagala
Mulagala

Reputation: 8661

Audio file to text file python

I want to convert an audio(ex: ".mp3") file to text file. I have tried different approaches like pyspeech and speech recognition, But i didn't get any answer. Is there any other way to do this..? Any help would be appreciated !

Upvotes: 9

Views: 31293

Answers (3)

user14913615
user14913615

Reputation:

way 1: convet audio file to bytes (0,1) with https://github.com/jiaaro/pydub or by f = open("test.mp3", "rb") first16bytes = f.read(16)

way 2: audio to speech convertors.eg.-convert to english or other language with pip libraries like SpeechRecognition pydub. (but i think you don't asked for this)

way 3: convert mp3 to Json. If anyone did this, then please share.

Upvotes: 0

kamran kausar
kamran kausar

Reputation: 4603

import speech_recognition as sr
print(sr.__version__)
r = sr.Recognizer()

file_audio = sr.AudioFile('file_audio.wav')

with file_audio as source:
   audio_text = r.record(source)

print(type(audio_text))
print(r.recognize_google(audio_text))

Upvotes: 2

Mike Driscoll
Mike Driscoll

Reputation: 33111

Did you try https://pypi.python.org/pypi/SpeechRecognition/ ? That sounds like exactly what you want.

I also found the CMU Sphinx project via this blog. It has Python bindings too (as mentioned in the article).

The other item I found was Google's Speech to Text API. You might want to check that out too. Here's a decent tutorial on this subject:

Upvotes: 6

Related Questions