0

I'm trying to get continuous voice recognition to work for a custom app on Android, using an ML18 bluetooth headset (by plantronics). I've managed to get rid of the beep produced by my phone by using the answers posted here and managed to route all other media to my bluetooth device using this.

However my bluetooth device is still beeping every time I call SpeechRecognizer.startListening.

Is there something I can do about this, or is this possibly hardwired into the software of the bluetooth device?

If you want to see specific sections of code, let me know. I do not think much of it is relevant however, as the two links above already cover the code that seems most relevant to me. Thanks in advance!

EDIT: So based on the comment below, I've modified my code into the following:

The start listening simply mutes all stream but the alarm stream (undone by unmuting all streams again).

public void startListening() {
    if (canListen) {
        Log.v(TAG, "Starting Listening");
        Intent recognizerIntent = createRecognizerIntent();
        recognizer.cancel();
        recognizer.startListening(recognizerIntent);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            ((AudioManager) getApplicationContext().getSystemService(
                    Context.AUDIO_SERVICE)).setStreamSolo(
                    AudioManager.STREAM_ALARM, true);
        }
    }
}

The Bluetooth receiver does this when the device is connected:

    AudioManager localAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    localAudioManager.setMode(AudioManager.MODE_NORMAL);
    localAudioManager.setBluetoothScoOn(true);
    localAudioManager.startBluetoothSco();

And then in the ACTION_SCO_AUDIO_STATE_UPDATED it sets the mode to AudioManager.MODE_IN_CALL.

Currently the behaviour is as follows: When I first start the app and connect the bluetooth device, as well as trigger the continuous recognition loop, all works as expected. Yet after a first reply has been uttered (using TTS), the beep returns... Again, any help would be appreciated :)

Community
  • 1
  • 1
MrHug
  • 1,315
  • 10
  • 27
  • You can probably show your code. The beep is played over STREAM_VOICE probably in sco modo, so you need to mute that stream as well, not just STREAM_MUSIC. – Nikolay Shmyrev Dec 21 '14 at 23:28
  • @NikolayShmyrev Hmm ok so that seemed to work for a little bit, but then it didn't after a short while (updated my question to reflect this new information) – MrHug Dec 22 '14 at 00:12
  • Ok, that's google thing. I would use pocketsphinx for android, it doesn't have any beeps and even more efficient for continuous recognition. – Nikolay Shmyrev Dec 22 '14 at 01:06
  • @NikolayShmyrev Hmm that actually looks pretty cool and from what I can see it happens locally on the phone? – MrHug Dec 22 '14 at 10:27
  • Yes, it's fully offline. – Nikolay Shmyrev Dec 22 '14 at 10:28
  • @NikolayShmyrev I've tried pocketsphinx - correct me if I am wrong - it's mainly good for limited grammers or language models. It os not so suitable for full dictation. – Ronen Rabinovici May 12 '15 at 21:53
  • @RonenRabinovici Unfortunately that was also my conclusion. Do you maybe have alternatives/solutions for this annoying sound bug? – MrHug May 14 '15 at 08:28
  • @MrHug - I have no experience with bluetooth sorry – Ronen Rabinovici May 15 '15 at 09:00

0 Answers0