Android Question XSpeechRecognizer annoying beep sounds - help ?

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone.
I made an app using XSpeechRecognizer made by @Multiverse app

There is very annoying problem going on , even with the given example:
When the recognizer is listening it is continuosly playing some "beep" sounds, that are very annoying (because when it start listening you are supposed to talk, and there is this annoying sound while you are talking).

I noticed that when the "beep" plays the Music Volume goes all the way down and then to the previous value. I understand that is the trick supposed to work to silence the annoying sound... but actually it is acting on the wrong volume setting. There is a way to solve this problem without changing the library? this is working very good! despite of this "bug".

This is the video demostrating the issue:

The volume that should be lowered, on my phone, is the red instead of the blue.
Another thing that can be done, maybe, is to enable/disabling the "silence mode" instead of lowering volume (?)




P.S. I already tried SpeechToText Offline but I need the Italian model, and it is very poor so does not work well in my case.


Thanks in advance, i hope this problem can be solved.
 

Mike1970

Well-Known Member
Licensed User
Longtime User
At the moment the only workaround i found is the following (still not optimal..., so a definitive solution is wished)

import the Phone library

Initialize like so:
B4X:
Obj_speech.Initialize(Me, "Event_obj_speech", 0, 0)

Before start the listener store the current volume level
B4X:
prev_volume_value = ph.GetVolume(ph.VOLUME_SYSTEM)
ph.SetVolume(ph.VOLUME_SYSTEM, 0, False)

After stopping the listener restore the volume level
B4X:
Sleep(1000)
ph.SetVolume(ph.VOLUME_SYSTEM, prev_volume_value, False)

if during the "speech to text" fase the user changes the volume or enables the ringtone the annoying sounds come back...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…