How to make A2DP and HSP work simultaneously - audio

I have a bluetooth headset. When connecting it to Windows 10, it installs two profiles in Playback devices list:
Hands-Free. (HSP profile)
Stereo. (A2DP profile)
The Second one (Stereo) is set to be the "Default Device" and the "Default Communication Device" on the system.
When I start any program that uses the mic (recorder, chat, VoIP Calls, gaming, etc.) The sound suddenly stops working And I can only use the mic until I stop the recorder or the call.
To enable the sound again I need to make the Hands-Free (HSP) profile handle both input and output (sound and mic). Unfortunately, HSP gives really poor sound quality.
I want to know If there is a way, using code, I can change Bluetooth behavior so the two profiles work simultaneously. One handles the sound and one handles the mic so I can have high quality sound and use the mic at the same time.

You will probably never find a solution. I had the same problem (I was trying to create a walkie talkie with 2 headsets connected to the same smartphone).
On Windows (but also on Android) you can't access directly to a BT-microphone or BT-speaker because it is automatically detected as BT headset and the OS take the control of the device.
Your app can then access the OS-device and not directly the hardware device. The only OS able to do that was Symbian I think which had the most BT-protocols. On Windows you will probably never be able to do that and on Android you have to write your own A2DP-protocol if you want to access the device directly without OS interference.
So sad...

Luckily, under windows you can define different devices for communications and sound.
So, you have two choices:
Choosing Hands-free for both mic/speaker only for communication (which will switch back to A2DP after the call/teams).
Choosing another mic for communication which allow you to still use the speaker profile even in communication.
That is a bluetooth restriction : A2DP (high quality audio) cannot be use simultaneously with HFP (hands-free profile)

Related

How can I receive Bluetooth audio signal and forward it to a Bluetooth speaker?

I need some help because I don´t know how to approach this challenge.
I want to build a device, that's receiving a Bluetooth audio signal and is forwarding it to a Bluetooth speaker. It´s also running some algorithms with the audio data and also simultaneously sending results via UDP to a different device.
I already thought about using two or three ESP32s, using one with an extra Bluetooth module, or searching for a whole different MCU with Bluetooth 5.0 or higher and Wifi 5GHz. But I don´t know approach the best is, or maybe a completely different one.
Some context, why we want to do it:
We want to create a real-time light show, based on the current playing song. It is already working for PC, but also want to make it accessible for phone users. Sadly there is no way to capture the internal audio on iPhone or Android phones. Our Idea to make the music sync with the phone possible is that you are connected with the phone via Bluetooth to our "sync box" which is then connected to the speaker via Bluetooth or AUX. The "sync box" is running our algorithms for creating the light shows and then sending the data to the microcontrollers from the light strips.
So maybe you have an idea how we can sync the lights to the music completely differently or how I can approach the challenge with Bluetooth.
Any help is highly appreciated.
Thanks a lot.

Connect Multiple Bluetooth Speakers with Raspberry Pi

I'm trying to connect several bluetooth devices with Raspberry PI to use them as speakers.
I'm using RetroPie as a distribution, because of the tests I've done it's the only one that matches and allows continuous synchronization with several bluetooth devices at the same time.
However, the system only detects the first device that connects as a sound card, the rest keep the bluetooth synchronization active, but it does not interpret them as audio cards even though it is indicated by blueman-manager.
Is there anything I can do to keep all devices synchronized and supported as audio cards?
Palm,
even so this a old post, it is not yet closed.
As I just got the same issue, here my answer.
What you try to do is to connect mutliple audio sreaming services (Speakers) to 1 audio bluetooth source, that is not possible like this. Therefore your PC only connects to the first box.
You could try multiple bluetooth dongles, but then you run into the timing issue with audio stream syncronization between the boxes.
The only solution is to use Bluetooth 4.1 upwards master-slave services.
Therefore the Speakers need to be connected to each other and seen as 1 device from the PC. In that mode the stream is skewed to ensure syncronous playing.
Many new Bluetooth speakers support this mode.
Hope that helped.

Emulate a Bluetooth Device from PC

I wonder whether it is possible to emulate a specific bluetooth device like a Remote Controller for a TV or another device with my PC. I'd be okay with installing an additional hardware device for my computer (e. g. a BlueTooth PCIe card).
I imagined something like "recording" all single commands of my original remote controller using my Bluetooth card and afterwards use these recorded commands to turn on my TV for example.
Is something like this possible (with additional hardware maybe)?
Of course this is possible. Bluetooth is just a protocol and you can impliment it in your custom software to emulate all kinds of devices. If you need to emulate simple devices like keyboard or mouse, there are many ready solutions like this.
But if you have non standard device, there won't be any ready solutions and you will have to implement it yourself. What can help you:
If you have some kind of controller for PC and you want to emulate device with unknown protocol, you can use WireShark or other sniffer to understand what's going on.
There is an emulator called BT-Sim, but it is so poorly documented that I can't even guess what it does.
You can can take as example different android software like described in answers to this question.
You can check different program samples for PC like this.
For hardware you need only simple Bluetooth dongle. However, if you want to spy on some BLE (Bluetooth Low Energy) devices, you can buy hardware sniffer like this.
(At least in Windows 10) Microsoft Store has an application called "Bluetooth LE Explorer" which is able to simulate different kind of Bluetooth GATT profiles as a peripheral.

Change flash player audio output device

Is there a way to change flash players audio output device? if not, is there a swf player who has this possibility? Thanks!
I had an issue until a few minutes ago regarding this.
Two audio devices are available to my XP box: an iMic USB audio I/O device, in which I have permanently plugged my desktop speakers; and a pair of USB headphones with microphone that I plug in occasionally.
The USB headset would take precedence over the USB iMic for applications because apps appear to access the last device plugged in to a USB port. With this in mind, here was my issue:
I would be listening to some Internettings on my USB headset.
Later, I would want to use my desktop speakers for the Internettings.
This entailed unplugging my headset, shutting down Firefox and opening it up again. Because the desktop speakers are considered the most recently plugged in device, they would be default for plugins.
This is damned annoying, I said to myself, and decided a little hacker mode was in order.
Keeping Firefox open, I used Task Manager to kill the "plugin-container.exe" process. This showed a crash screen on any Flash Player applet in Firefox. Then I unplug the headset, and reload the Web page with the applet. Without restarting Firefox, Flash will then play through my desktop speakers.
If I wish to listen on the headset again, I plug the headset in, kill plugin-container.exe, and reload the page. Wham.
For as rare as I intend to switch audio devices, this will cover up part of the mess Adobe left.
I am 99% sure that setting the audio device used by the flash player is something you would need to do on an OS level. You can change the device that flash uses for microphone and video input from the player's settings, but I don't think you can change audio output.
I have found a solution, at least for the Firefox browser, to direct HTML5 audio to a specific audio device:
https://addons.mozilla.org/en-US/firefox/addon/chaudev/
Note: this is a new Firefox addon waiting to be reviewed developed by a friend of mine.
I have been waiting for this for years.
I wanted to use this when my wife is seeing YouTube on her Chrome browser and me seeing anything like Coursera online MOOC lectures (FF) on the TV which is connected to the pc. I wanted to hear my classes on the headset and my wife on the speakers for YouTube.
I have 2 mouses (one for me, wireless) and have installed a neat program called TeamPlayer which gives multiple cursors (each cursor for each mouse).
So I have now literally the capability of 2 persons working on 1 pc.
And on top of that it works seamlessly with "Enounce Myspeed" for speeding up the video lectures' playback.

Wireless protocol for accelerometer data

I'm building an application where a mobile phone with an accelerometer is used to control an app on a computer in a similar way you would use a mouse. So I need to send the movement from the phone to the computer over some wireless protocol. I am thinking about using Bluetooth but I am not sure what transfer delay to expect. Another possibility is using 802.11g. What do you think? What delay could I expect given that I don’t hit the bandwidth limit?
I worked with a group at Motorola who linked up an external accelerometer pack to a mobile phone using Bluetooth. This work supported a mobile games development class at USC's GamePipe Laboratory, and the speed was sufficient to control the mobile games developed by the students. You'll need to make sure your handset's Bluetooth stack has the correct profile enabled to allow data communication.
Another advantage of Bluetooth over 802.11g is that the frequency hopping Bluetooth uses will make it less vulnerable to interference by all the other 802.11 devices in the vicinity, which sit on one frequency.
I wouldn't expect the amount of data sent by an accelerometer would give Bluetooth any problems.

Resources