Python Forum

Full Version: Speech Recognition with timestamps
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
this is my code:

import speech_recognition as sr
r = sr.Recognizer()
with sr.AudioFile("PATH") as source:
    audio = r.record(source)

try:
    sent = r.recognize_google(audio)
    print(sent)
except LookupError:
    print("Could not understand audio")
the output prints all the words that said in the audio in a long string like this:

Output:
now i know everything[...]
i would like to know if there is a way to print each word individually and after that print the start and the end times that this word was said, like this:

Output:
now startTime = 1.3s endTime = 1.4s i startTime = 1.6s endTime = 1.65s [...]
I'm using python 3 in Pycharm and i'm using speech_recognition.
I have same problem, i am need timestamps in speech recognizer. I am found something called google-cloud-speech whitch has this, but i dont know how to implement it, may be someone who more familiar with google cloud does
@Limofeus if you have any problem, please start a new thread instead of writing in an original one which hasn't been written by you
hello, I hope u well,
do u know how to solve it?