Python Forum
Speech Recognition with timestamps - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Speech Recognition with timestamps (/thread-20858.html)



Speech Recognition with timestamps - DeanAseraf1 - Sep-03-2019

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.


RE: Speech Recognition with timestamps - Limofeus - May-05-2020

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


RE: Speech Recognition with timestamps - pyzyx3qwerty - May-05-2020

@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


RE: Speech Recognition with timestamps - gh_ad - Jun-27-2021

hello, I hope u well,
do u know how to solve it?