Streaming audio between external bluetooth device and Android phone - android

I'm considering building an Android app that allows for streaming audio via bluetooth to and from the Android phone. I've read similar questions on Stackoverflow before, and based on my understanding, A2DP cannot be used as Android can't become an A2DP sink.
In theory, I believe that a profile such as HFP or HFP AG should allow for bidirectional audio streams. In the Android API, is there a way to force a bluetooth pairing to follow this profile, or does the OS decide which profile to use (such as forcing HFP only when there's a phone call going on)?

I've been able to achieve what I wanted using RFCOMM-based SPP. In order to send audio to the external device, I use the AudioRecord API to record PCM-16 audio to stream audio realtime over Bluetooth. In order to receive audio, I spawn a thread that is responsible for outputting audio to the speaker using the AudioTrack API (in streaming mode)

Related

Multichannel Audio recording in Android

I have a multichannel microphone connected to an android phone (pixel 3) through usb. I'm trying to use MediaRecorder API for recording audio. However, there doesn't seem to be a way to setup multichannel recording with MediaRecorder even though Android USB audio documentation seems to say it allows multichannel input. I know recording multi channel audio is possible, as there are apps that already do that (see ntrack). I'm trying to figure out how to do this and hoping it doesn't involve writing usb driver (like these developers).
If you can see your microphones as separate input devices using audioService.getDevices(AudioManager.GET_DEVICES_INPUTS) then you can use the AAudio API (preferably using Oboe library) to access each of these microphones by opening stream for each.

Android- stream live mic audio from one device to multiple devices via WiFi

I am currently researching on building a live broadcasting module as a part of my app and this is the usecase: One user A will record his voice using the mic and this data has to be streamed to a server while the other devices should be able to receive this audio and play it.All of them will be connected to the same network. I would like to preferably use a server that is not java based. I have currently looked into the solutions provided in the following links:
[1]: Stream Live Android Audio to Server [2]: Streaming voice between Android Phones over WiFi [3]: Android streaming live mic audio between two android devices via wifi
I have also considered some 3rd part libraries but I do not wish to use them since they are expensive.

Android Record audio from Bluetooth A2DP source

I have a custom bluetooth wearable that essentially has two microphones, streams A2DP and handles AVRCP commands. I would like to connect this device to an Android phone and record audio either with AudioRecord or in native code. I need to do some signal processing on the data so I can't have it record directly to a file.
I have managed to build a version of Android using AOSP which will pair with the device and appears to receive the A2DP stream but I have not been able to build a version of the OS/SDK that allows me to use AudioRecord. I have gotten to the point where I can add a source for A2DP but I'm missing something at the native layer to fully make the connection.
Ideally, I would also like to control the input with AVRCP.
I am currently testing with a hammerhead device, but am will to move to another device if that works better.
Any input appreciated.

Video Streaming over bluetooth

Hi I want to stream a video from my android phone to another android phone over bluetooth, I see that there is a VDP to use but this profile is not available in android sdk there is a profile A2dp which is responsible for audio streaming only. Is there a different method in order to implement that with android sdk?
As I known, if you want to make the video streaming over bluetooth, it's not suitable. Because whether SPP or BLE is not suitable for this kind of mass data transmission, I mean that if you want to make it as good as the A2DP over bluetooth, I mean the Real-Time. But if you don't care about the Real-Time. You can use SPP or BLE to transmit the video data, and encode/decode the video data by yourself. The most important is that the transmit speed of Bluetooth.
If you just only need to transmit the video file to the other device, you can treat the video as a file, and transmit it as data.
I think there is an AVDTP profile to do that in Bluetooth classic.
and even AVCTP for controlling that stream as well.

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.

Categories

Resources