Android Application: Separate audio streams for separate headsets - android

I am currently trying to figure out an issue related to routing separate audio streams to different headsets simultaneously in my android application.
Basically, what I need is to stream one sound file to a wireless Bluetooth headset and simultaneously stream a different sound file to another headset. The second headset can be either wired or Bluetooth, it doesn't really matter as much.
Has anyone attempted something similar to this, or have an idea of how to go about doing this?
Thanks

Related

Multiplexing two Bluetooth devices to create dual audio

We want to tackle the age old question of connecting two musicboxes over bluetooth and stream music on them simultaneously.
We know, that modern smartphones are able to connect to two devices but the output audio stream only connects to one device. And according to a lot of different sources the A2DP Profile is also only able to have one Master and one Slave.
Our approach would be a multiplexing of the said audio output between the two connected devices. So on android we would just have to change the desired audio output fast enough between two boxes.
The first question here would be if the switching between two audio outputs on android is fast enough and the music doesnt stop streaming?
Secondly we have to determine if the switching can happen fast enough for us to dont hear any skips.

Android Framwrork bluetooth A2DP + HDMI

We are developing the Android Framework, and the default of the audio output is HDMI.
When the bluetooth is connected with the Android, the audio output will be redirected to the bluetooth via A2DP protocol. How can we route the audio to the bluetooth speaker and the HDMI output at the same time? We have looked framework/base/media/java/android/media/AudioService.java and the frameworks/av/services/audioflinger/AudioFlinger.cpp, but I have no idea now. Does someone has the experience? Thanks!
I am quite certain that this is not possible to do.
I am completely convinced that this is something that you shouldn't do.
When you send audio over A2DP it is re-encoded, it is not the same audio stream that the one you send over HDMI.
They will also be out of sync, since you have completely different delays between A2DP and HDMI.

Has anyone tried to play sounds through the speakers and headphones at the same time? Android + iOS

I currently have an app that generates sounds on the fly, like pure tones and white noise, and I can hear that on the headphones.
Is it possible to send the same signal to the internal speakers and the headphones at the same time? I would like to do this on iOS 7 and KitKat. Probably, Android L and iOS 8 in the future...
On iOS I have seen that a new feature was introduced on iOS 6, multiroute, which let select the audio route. The thing is that when I connect the headphones I can not choose the internal speakers. Maybe I am doing something wrong. I think that would help me on Android...
On Android, I have found this simultaneously using a headphone and speaker. But that is from one year ago.
Has anyone tried this?
Thanks!
On iOS, I don't think you can route audio to both the headphones and the speakers. You can control the routing to different audio interfaces using the multi-route audio code included in this Apple WWDC slideshow, but the built-in headphone jack and speakers are part of the same audio interface, and I don't think there is a way to override the behavior within that interface of disabling the speaker when the headphones are connected.
To do this on Android, it should suffice to set your audio stream to STREAM_ALARM:
MediaPlayer player = new MediaPlayer();
//
// Your player initialisation code here
//
player.setAudioStreamType(AudioManager.STREAM_ALARM);

Play music via android speakers

I want to make an app that makes it possible to connect an iPod or mp3 player to my Android device and let the Android speakers function as external speakers.
The ideal situation would be to actually read from speaker output so I can connect a stereo mini jack cable.
Is it possible to read from the headset output with the Android SDK?
A second option would be to use a mono mini jack instead. I could maybe directly read from microphone and output as a music player. Although, having to use a mono mini jack would be a huge disadvantage, because most people don't own such a cable.
UPDATE
For my second option I found this link that would let me take a special adapter onto a stereo cable so the iPod output can go into the mic input. It's a TRRS adapter. This works, but still isn't the ideal solution to me. http://www.techlife.net/2012/12/add-an-audio-input-to-android.html
ANOTHER UPDATE
I did a test with only a mono cable, but it seems that the mic is not recognized, so I really need the TRRS adapter to make sure that the mic is on. I found some apps that can help me with measuring input volume. I think I can achieve my goal for myself with the adapter, but reading from headset output would be nicer and could actually result in building an app.
You need to understand some basic things...
Audio output lets you "take audio out of your device".
It's not audio input that would let you "insert audio signal into your device".
So the concept that you've presented cannot work, because this socket is not able to receive audio signal through normal stereo jack cable (and connector).
You could try to make it work with a device that supports the headphones/mic set (it's a different kind of 3.5 mm jack connector). It's so called TRRS (four-conductor). But to use it in your project you probably would need some cable/socket soldering and maybe even some sort of microporcessor to help processing the signals.

Recording audio from many source/microphones

I'm curious if it's possible to record audio from many sources and if not, what's the limitation.
Many current devices have two internal microphones (basically for noise reduction). On top of that it's possible to plug additional external one using audiojack. You can as well have another audio stream via bluetooth headset.
You are allowed to specify AudioSource in android but is it possible to do recording from many sources at the same time? I'm also interested how the situation look like on the iOS devices.

Categories

Resources