HomeForumsOpenEarsUsing Bluetooth headset…

This topic has 4 voices, contains 15 replies, and was last updated by  marco 288 days ago.

Viewing 16 posts - 1 through 16 (of 16 total)
Author Posts
Author Posts
February 1, 2011 at 7:47 pm #3850

bvelasquez

Is it possible in the current implementation to utilize a bluetooth headset for both the audio capture and the Flite engine? When a bluetooth headset is active (with ADHP), the sound still comes through on the phones speaker. Audio capture also does not appear to be using the bluetooth headset. Any ideas on how to get this working?

February 1, 2011 at 8:07 pm #3851

Halle

Hi bvelasquez,

I don’t have the hardware to test so I’m afraid I’m not going to be able to be too much help, although this is a question I’ve been curious about as well. To give it a try, in AudioSessionManager.m, you can go to the method:

- (void) startAudioSession;

and try adding this code:

UInt32 bluetoothInput = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,sizeof (bluetoothInput), &bluetoothInput);

right after:

UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord; // Set the Audio Session category to kAudioSessionCategory_PlayAndRecord.
	OSStatus audioCategoryError = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(audioCategory), &audioCategory);
	if (audioCategoryError != 0) {
#ifdef OPENEARSLOGGING
		printf("OPENEARSLOGGING: Error %d: Unable to set audio category.n", (int)audioCategoryError);
#endif
	}

You also may need to comment this out:

UInt32 overrideCategoryDefaultToSpeaker = 1; // Re-route sound output to the main speaker.
	OSStatus overrideCategoryDefaultToSpeakerError = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryDefaultToSpeaker, sizeof (overrideCategoryDefaultToSpeaker), &overrideCategoryDefaultToSpeaker);
	if (overrideCategoryDefaultToSpeakerError != 0) printf("Error %d: Unable to override the default speaker.n", (int)overrideCategoryDefaultToSpeakerError);

Please let me know your results.

February 1, 2011 at 8:44 pm #3852

bvelasquez

Great! That worked great. However, commenting out overrideCategoryDefaultToSpeaker had obvious consequences. When bluetooth is off, the sound comes through on the internal speaker. Other than that, without bluetooth, the input comes through on the mic. With bluetooth, all input and output goes through the headset. Just need a clean solution for switching to external speaker in the absence of bluetooth.

February 1, 2011 at 9:01 pm #3853

Halle

What happens if you don’t comment out the overrideCategoryDefaultToSpeaker? BTW, does recognition still work with bluetooth as input? I don’t know if that forces a change in the sample rate so it might not make Pocketsphinx 100% happy — check out whether it’s still working before we take on device detection.

February 1, 2011 at 9:57 pm #3854

bvelasquez

That works. Uncommenting allows it to switch between bluetooth and speaker. However, more often than not, I get a EXC_BAD_ACCESS after switching between one or the other while running the app. Restarting the app clears this up and it works good thereafter. I believe this is happening in the Flite code because it happens as soon as I “say” a response after input. So, something in that part of the code doesn’t like switching between different output devices while an app is running.

The bluetooth recognition works fantastic as an input device. I don’t see a problem with it. I think I might have to recalibrate when I switch though. I’ll test further and let you know what I find. I think device detection would be a very nice option. Perhaps auto recalibrate or methods for switching and some delegate methods to let you know what is going on? This can be done external to your library, so you might want to leave it up to each individual developer to implement.

February 1, 2011 at 10:55 pm #3855

Halle

What bluetooth device is this? The EXC_BAD_ACCESS is a bummer, I’m pretty sure there is no way for me to effectively troubleshoot that without seeing it on my own system. But you might see some relevant debugging info before the crash if you turn on OPENEARSLOGGING and VERBOSEPOCKETSPHINX.

That’s excellent that the recognition is good. You should always recalibrate if you switch devices because they will have different mic response profiles and that means the sound level that indicates silence (the most important thing for continuous recognition since it indicates when a statement is over) has to be rediscovered.

February 2, 2011 at 12:49 am #3856

bvelasquez

Ok, I’ll put the recalibration in as soon as I find out how to detect audio device changes. Also, I’ll get the logging going and see if anything stands out. I have a Jawbone ICON headset, which is fairly good. It has an ADHP profile, which allows it to act as a speaker. Necessary for applications like this. If you invest in one, make sure it does ADHP.

I’ll let you know if I find anything in the debugger.

Thanks for your help and the great library.

February 2, 2011 at 9:06 am #3857

Halle

For recalibration, you can detect audio device changes by using the – (void) audioRouteDidChangeToRoute:(NSString *)newRoute; method in OpenEarsEventsObserver. There’s an example of how to do that in the sample app. If that doesn’t report changes to you regarding the bluetooth device let me know.

February 2, 2011 at 8:23 pm #3858

bvelasquez

That detects the bluetooth audio change. I call [self.myPocketsphinxController stopListening] and [self.myPocketsphinxController startListening] when I receive the event. Seems to work well and the EXC_BAD_ACCESS hasn’t appeared since doing this. I’ll test further. However, I can now switch to any audio route and the app behaves nicely.

Now, if I can find a good audio transcription engine that plays nicely… :)

Thanks again.

February 2, 2011 at 8:50 pm #3859

Halle

Cool, I’ll see if this can be supported in the shipping code in the next version. Glad it’s working for you!

May 23, 2011 at 2:37 pm #3860

Halle

I have added this as experimental Bluetooth support to the just-posted OpenEars 0.91.

August 3, 2011 at 3:24 am #7430

marco

Hi halle,

What bluetooth headset would you recommend so that it would maximize the performance of your library? I’m planning to buy one but i’m having doubts as to what brand and features should i get. I’m also on a really tight budget.XD

August 3, 2011 at 10:21 am #7436

Halle

Hi marco,

I wish I had a recommendation! I have gotten no feedback on the bluetooth code, so I have no advice and can’t even say whether it will work with one headset or another at all. If you have any opportunity to borrow someone’s headset and test before purchasing, that is probably the safe bet and I would also be interested in hearing whether it works in the current version.

August 3, 2011 at 6:16 pm #7443

darbienapp

Marco,

I’m using a Motorola H550 and it’s working perfectly. However I don’t know if they are still selling it since it’s an older model I got couple of years ago.

August 3, 2011 at 7:21 pm #7451

Halle

Cool, great to hear.

August 4, 2011 at 2:55 am #7457

marco

Darbienapp,

Thank you for your review! I’ve got my eye on 3 bluetooth headsets that are compatible for the iPhone 4: HiSense HB200M, LG HBM-235, and Jabra BT2080. Hopefully one of these headsets would work perfectly together with the library. Thanks again!

  • This reply was modified 288 days ago by  marco. Reason: Update
Viewing 16 posts - 1 through 16 (of 16 total)

You must be logged in to reply to this topic.