gotev / android-speech

Android speech recognition and text to speech made easy
http://gotev.github.io/android-speech/
Apache License 2.0
473 stars 156 forks source link

Mute Tune #43

Closed MohsinaliEMed closed 3 years ago

MohsinaliEMed commented 3 years ago

How can silence the start sound and end sound (tone or beep) ?

gotev commented 3 years ago

That's been asked before and it's not possible since the library relies on the Android bundled in voice search engine which controls the beep autonomously.

yuripourre commented 3 years ago

@MohsinaliEMed @gotev Actually, there is a way mute it, not beautiful but works.

https://github.com/yuripourre-forks/Speech-Recognizer/blob/master/app/src/main/java/com/sac/speechdemo/MyService.java#L139

gotev commented 3 years ago

@yuripourre workarounds like that may work for the specific use case but can have many different unwanted consequences when considering your app running together with other apps, because the audio channels are muted and you have to be very careful to restore them. There are also situations when you simply could not do anything to restore proper audio channels status properly, causing unwanted behaviors, for example receiving a call while running the speech recognition.

I personally strongly discourage practices like that, which may be dangerous to the entire ecosystem of apps. To have voice recognition without the beep I advice to use a different speech recognition engine, like Google Cloud Speech or just be fine with the tone, which is however the same across all the Google products and very familiar to final users.

yuripourre commented 3 years ago

@gotev Fair enough. I just linked here in case people desperately need a (dirty) workaround.

gotev commented 3 years ago

@yuripourre usually that kind of despair comes 99% out of poor management, which has to be stopped from thinking the wrong way. We devs all love good and clean code and to deliver quality products. Pushing devs to do dirty stuff is not right and we should all stand against workarounds which can be avoided in the name of the good product quality we deliver as professionals.