I am building a small project where user will speak the time duration and the voice assistant will answer which lecture they would have to attend during that duration. For example -user said 10:45 to 12:45 then the voice assistant must answer Software Testing. Here the problem which I am facing is that my microphone is unable to take time durations like 2:15 to 3:15 and some other time durations too. To sum it up it is able to recognize some of the time durations and is unable to recognize rest of them. What should I do?
-
Are you using the [SpeechRecognition](https://pypi.org/project/SpeechRecognition/) module? Or a different module? – dstricks Apr 01 '22 at 02:32
-
I am using the "speech_recognition" module to collect time duration from the user and pyttsx3 to speak out the lecture associated during that duration. – Varun Shrivastava Apr 01 '22 at 14:32
1 Answers
You should experiment with other speech recognition engines that are supported by the SpeechRecognition module to see if a different one works better for your use case. As of April 2022, there are 8 speech recognitions available to select from.
Take a look at this example code provided by the authors of the SpeechRecognition module: https://github.com/Uberi/speech_recognition/blob/master/examples/microphone_recognition.py
It demonstrates how different recognition engines can be used (Sphinx, Google, etc.). If none of those work well for you, it might be necessary to check out a different Python module. Unfortunately, speech recognition is very difficult and you're not going to be able to tweak the underlying models without putting forth a significant effort.

- 1,465
- 12
- 23
-
I tried using a couple of different engines and now there is a different problem whenever I say 2:15 to 3:15 it interprets it as 215 2315. Although it successfully understands time durations like 10:45 to 12:45 but mostly screws up with the ones that end up with 15. – Varun Shrivastava Apr 02 '22 at 13:54