Merge pull request #248 from arpitbhardwaj/speech_to_text

Added speech to text script
This commit is contained in:
Advaita Saha 2022-10-09 18:13:01 +05:30 committed by GitHub
commit 98a3661dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# Speech to Text
This is a simple script that lets you convert speech to text
#### Usage
* Clone the repo
* Move to folder "scripts/Speech_To_Text"
* download the python libraries mentioned in requirements.txt using `pip install <library>`
* run `python script.py`

View File

@ -0,0 +1 @@
speech_recognition

Binary file not shown.

View File

@ -0,0 +1,15 @@
import speech_recognition as sr
import os
filename = "sample.wav"
# initialize the recognizer
recognizer = sr.Recognizer()
# open the file
with sr.AudioFile(filename) as source:
# listen for the data (load audio to memory)
audio_data = recognizer.record(source)
# recognize (convert from speech to text)
text = recognizer.recognize_google(audio_data)
print(text)