I've been researching the ability to create a bi-directional audio link between iOS and a bluetooth audio headset.
What I need to be able to do is:
When the user speaks into the microphone on the iOS device, that audio should be redirected to the audio out of the headset, the piece.
When the microphone of the headset picks up audio, that should come out the speaker of the iOS device.
In my searching I've found that you can:
Enable bluetooth audio input and output:
how to route iPhone audio to the bluetooth headset
Redirect input to speaker:
Mic input to the speaker output on an iOS device?
After reading this:
AudioSession input from bluetooth output to line out or speaker
I'm thinking what I want to do cannot be done.
So before I get to testing, does anyone know if what I'm trying to do is even possible. From the last link it appears you can only have one input and output pair at a time. What I'm trying to do would require two pairs of input and output. In from BT, out to iOS speaker. In from iOS Mic, out to BT.
Thank you!
The current public iOS Audio Session APIs appear to only support a single audio route pair (input+output).
Related
I'm simulating an incoming call notification by playing an audio file through AVAudioPlayer. I wish to play the audio to both built-in speaker and connected bluetooth headset simultaneously.
I tried using AVAudioSessionCategoryMultiRoute and AVAudioSessionCategoryPlayAndRecord with AllowBluetooth category option selected.
For AVAudioSessionCategoryMultiRoute, it is not able to detect the bluetooth device in available outputs.
For AVAudioSessionCategoryPlayAndRecord, audio is routed to either bluetooth or speaker depending on the category option passed in while setting up the audio session category.
Is it possible to route the audio to both built-in speaker and bluetooth device simultaneously using AVAudioSession API? Any code snippets, if available?
Looking at the documentation of AVAudioSessionCategoryMultiRoute it states that (emphasis added by me)
The category for routing distinct streams of audio data to different output devices at the same time.
Meaning that you can only output different audio streams to different output channels. You cannot output the same audio stream to several channels.
As far as I'm concerned, there are no other methods to achieve playing the same audio stream on several channels either.
Sorry if this question is obvious or duplicated. My 30 minutes of research led me nowhere.
We have an iPhone app that live streams video from the device to our remote Wowza servers.
We're looking to integrate the Swivl (motion tracking tripod) into our product, and it uses a wireless microphone that feeds into the 30-pin port of our iPhone. Swivl's SDK doesn't include anything about capturing audio from their hardware so I assume that it would be handled by the iPhone itself.
If I use the AVAudioRecorer, will it automatically route the audio input from the 30-pin port instead of the default microphone, or do I have to explicitly define the audio source?
Any clues help.
After a few tests, it seems that iOS automatically routes incoming audio signals.
There is no need to explicitly specify the source of the audio.
Straight from AVAudioRecorder documentation:
In iOS, the audio being recorded comes from the device connected by the user—built-in microphone or headset microphone, for example. In OS X, the audio comes from the system’s default audio input device as set by a user in System Preferences.
I would like to be able to control a bluetooth headset from an iOS device and turn off the audio output, effectively only making it a bluetooth microphone. I am using the HSP headset profile.
Possible?
Pointers?
Not possible
BTW where do you want the output to be routed ? on the phone speaker ?
Let us say I have an audio iPhone app which takes input from the microphone.
Now, although I haven't tried this myself, I believe the user could use an external microphone that plugs into the phonojack socket.
This means my audio unit could be receiving its input from the internal or the external microphone.
My guess is that iOS will automatically route from an external microphone if it is connected.
But what if I don't want that?
Is there a way to specify which microphone should be used?
I have looked in the audio session guide, I can find some setting regarding a Bluetooth headset. But that is as close as I can find. It appears that it is not possible. But I find that difficult to believe.
PS Also I am curious how it detects an external microphone... if I plug my headphones in, it should continue routing from the internal microphone. my headphones are just plain stereo headphones. but if I used my mobile phone's headphones ( on extra band on the Jack... they have a microphone built onto the cable where the individual earpiece strands meet ) I would expect it to pick up this source instead.
You have to use the AUHAL unit to set a specific input device as default input and then connect it with the AudioQueue.
Apple has a detailled Technical Note for that: Device input using the HAL Output Audio Unit
I am using Alert.startAudio to play an array of short values,
I want the same short[] to be played using the phone speaker, how could I do this ?
I believe it is played with speaker by default!
But if it's not, try to use AudioPathControl
See BB KB How To - Specify Audio Path Routing
UPDATE
BB Developer Journals - The BlackBerry Alert Class:
The next two methods will start and stop an audio alert on the audio channel selected by the user. An audio channel can be the internal headset, speaker, earpiece or a Bluetooth® headset.
maybe this should be configured somewhere in device...