Hi, I created a voice calculator project in MIT App Inventor that supports basic operations (+, -, *, /). It works fine for numbers below 1,000, but once I try numbers starting from 1,000 and above, the recognition becomes inconsistent.
Sometimes it mishears the number or operator, and other times it fails to process the input entirely. I checked the recognized speech list after I speak, and while it's capturing something, it often doesn't register the full number correctly.
For example, when I say "ten thousand five hundred," it might only catch "ten" or "five hundred," or jumble the result. The biggest issue happens when I try to add two 5-digit numbers (like "12345 plus 67890") — the voice recognition simply cannot understand the full input or splits it incorrectly.
If there’s a known limitation or a workaround to improve recognition for larger numbers, I’d really appreciate your help!
Use a SpeechRecognizer component to listen to the user speaking and convert the spoken sound into text using the device’s speech recognition feature.
Properties
Language
Suggests the language to use for recognizing speech. An empty string (the default) will use the system’s default language.
Language is specified using a language tag with an optional region suffix, such as en or es-MX. The set of supported languages will vary by device.
Result
Returns the last text produced by the recognizer. UseLegacy
If true, a separate dialog is used to recognize speech (the default). If false, speech is recognized in the background and updates are received as it recognizes words. AfterGettingText may get several calls with partial set to true. Once sufficient time has elapsed since the last utterance, or StopListening is called, the last string will be returned with partial set to false to indicate that it is the final recognized string and no more data will be provided until recognition is again started. See AfterGettingText for more details on partial speech recognition.
Events
AfterGettingText(result,partial)
Simple event to raise after the SpeechRecognizer has recognized speech. If UseLegacy is true, then this event will only happen once at the very end of the recognition. If UseLegacy is false, then this event will run multiple times as the SpeechRecognizer incrementally recognizes speech. In this case, partial will be true until the recognized speech has been finalized (e.g., the user has stopped speaking), in which case partial will be false.
BeforeGettingText()
Simple event to raise when the SpeechRecognizer is invoked but before its activity is started.
Methods
GetText()
Asks the user to speak, and converts the speech to text. Signals the AfterGettingText event when the result is available.
Stop()
Function used to forcefully stop listening speech in cases where SpeechRecognizer cannot stop automatically. This function works only when the UseLegacy property is set to false.
So show us how you are using
the UseLegacy flag
the partial return?
non-English environment
If totally lost and unable to read docs, export and upload your aia file.
What you can do with App Inventor to improve recognition is limited compared to using Android Studio etc. with its extensive libraries. However, there are small things you can do to improve recognition.
Here are some suggestions from a Speech Recognizer tutorial How to avoid mistakes
Experiment with the various Parrot option choices until you find something the fits your speeking/dictation style. - A secret to making a Speech Recognizer work is to speak in a strong, steady, clear voice. Even then, the Parrot recognizer WILL make mistakes.
I show one way to delete words Parrot misspeaks…type the word that must be eliminated, press Delete or use the Delete Last of to delete the last spoken text.
There are a few grayed out Blocks of code at the top of the AfterGettingText event handler. Restore the Blocks and these or similar blocks can be used when the SpeechRecognizer is stubborn. Yes, sometimes it refuses to provide the word you speak. For example, if you do not want to record 2 when you say 2 but to print out two or to respond with for when it thinks you say four, you make it obey when it mis-understands your pronunciation.
What you can do with App Inventor to improve recognition is limited compared to using Android Studio etc. as I said. There are small things you can do to improve recognition.
The advice is basically to learn to talk to your recognizer. Speak in a steady, clear voice without background noise. That really does help.
Users who first language is English is their first language do better than those for who it is a second language and have even a slight accent.
Learn to write code to ameliorate some of the 'errors' you get while speaking
When your app if frequently making mistakes with voice recognition, provide a TextBox to provide input in text.
Note that App Inventor does not implement its own speech recognition engine, we simply call the platform-defined speech recognition API. On iOS this is always Siri, on Android it is typically Google but other manufacturers (e.g., Samsung) may provide their own speech recognition implementations. App Inventor makes no attempt to normalize the output, so depending on what phone you have you may get slightly different results for the same spoken input.