Sending audio to a bluetooth enabled speaker, IOS - bluetooth

I want to add a function to my App, where the user can choose to play the audio on a bluetooth enabled speaker. I have a Parrot Easydrive in my car and this works for phonecalls and for example the Dictafoon App among others.
I understand that I should use the Core Audio framework. WHen a bluetooth device is connected it is said that it is easy to stream the audio to that connection. I am now looking for Core Audio sample code (or a book) where connecting and streaming to a bluetooth device with Core Audio is explained.
Can anyone shed a light on this? If there is another framework or sample code which I can use please mention it!
Many thanks in advance!

You don't write any specific Core Audio code, it is the same process as is used to play audio via AirPlay.
Basically you put a MPVolumeView into your UI, and the underlying framework will redirect your audio output for you. Once you implement this you will be able to use Bluetooth and any AirPlay enabled device with your app.

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.

Getting data from audio mixer

I am trying to build an open-source in-ear monitoring system. I have created the UI and was wondering how I would get the channels that are on an audio mixing console so that I can edit the channels and stream them to each musician. Is there a certain protocol that all the mixers use? You can find the project at https://gitlab.com/openstagemix. We would love to have contributors.
I can't really test whether this is the correct answer as I am trapped in my house during the coronavirus time. But, all mixers use something called OSC which is a protocol between mixers, synthesizers, etc. to computers. You can find more information here http://opensoundcontrol.org/introduction-osc.
Update:
It's neither! I am going to use the AES67 standard to receive information from my mixer and with that process the audio. This is because my mixer is ethernet capable.

Can anyone explain how voice commands works via Bluetooth remote(Nexus player remote) in Android(Nexus player)?

Can anyone please elaborate following questions?
How bluetooth stack handles audio data?
How audio commands are processed?
Did we need any service to process audio data?
Thanks in advance.
Basically, voice commands over BLE require:
some audio codec for reducing required bandwidth (ADPCM and SBC are common, OPUS is emerging),
some audio streaming method through BLE,
decoding and getting the audio stream from BLE daemon to a command processing framework.
In the android world, command processing framework is google sauce (closed) that most easily gets its audio from an ALSA device. What is left to be done is getting audio from the remote to an ALSA device.
So for audio streaming, either you:
use a custom L2CAP channel or a custom GATT service, this requires a custom android service app and/or modifications to Bluedroid to handle those, it will need a way to inject audio stream as ALSA, most probably with a "loop" audio device driver,
declare audio as custom HID reports, this way, Bluedroid injects them back to the kernel, then add a custom HID driver that processes these reports and exposes an audio device.
Audio over BLE is not standard, so all implementations do not do the actual same thing. In Nexus Player case, implementation uses HID: It streams an ADPCM audio stream, chunked in HID reports. There is a special HID driver "hid-atv-remote.c" in Android linux kernel that exposes an ALSA device in addition to input device. Bluedroid has no information about audio, all it does is forwarding HID reports from BLE to UHID.

Can PulseAudio/ALSA work without built-in soundcard?

I am new to PulseAudio and ALSA, so please go easy on me. This might seem like a dumb question, but it is quite important to have it answered.
I am developing application on ARM imx6 board (lets call it BOARD1), with built-in sound card support. With ALSA, I am able to play audio throgh Headset_OUT. But now, we want to move to a new board (lets call it BOARD2), which does not have built in soundcard. But the idea is to connect a bluetooth module to the BOARD2 and have the audio streamed to the bluetooth speaker.
My question is, is it possible to use PULSEAUDIO to send/receive audio to external (bluetooth) audio device without local embedded soundcard (i.e. is it possible to do audio encoding/decoding in just software with pulseaudio and gstreamer combination) ?
Regards

Module audio bluetooth (iOS and Android)

I'm working on university project that consists in audio speaker with bluetooth connected to mobile application.
I search a lot possibilities and bluetooth modules that comply my needs, but I have not found any module. I need a Bluetooth module that can receive audio and work in iOS and Android, but I see that a lot of modules with Classic Bluetooth (lowe than 3.0) do not work with iOS, but 3.0 and 4.0 version works with both but are not oriented in audio.
I'm looking for if someone can help me finding one kit with audio receive bluetooth for all plataforms intended for speaker and cheap. Or separately one bluetooth module receiver with 3.0 or upper version (because works in iOS), intended for audio streaming to an speaker, and with some UART pins (tx/rx for example) that can simplify the connection with a microcontroller. And one basic microcontroller oriented to bluetooth receives (with some bluetooth libraries) or simply to program with upp-level language. This microcontroller just receive the audio (bits) and send it to the speaker.
I read too that Smart Bluetooth or Bluetooth Low Energy works on iOS, but can't send audio, have small rate, but i think Smart Ready Bluetooth its possible, but not sure, I have just seen that supports Classic Bluetooth (oriented to audio) and Bluetooth Low Energy, it's possible sens audio with it?
In short, I'm looking for one module Bluetooth 3.o or 4.0 + EDR (that can send audio) for iOS and Android. I find HC05, CC2506X, or HC06 module, but I have read not works in iOS. And a basic microcontroller simply to program to receive this bluetooth audio to send in a speaker.
If someone know one basic kit, or useful information for me I would appreciate.
Thanks.
There is a bluetooth module BC127. it is available at Sparkfun. It dual mode. Means It can work as source and sink both.
Source means, It can Transmit Audio
Sink means, It can receive Audio
Here is link for https://learn.sparkfun.com/tutorials/understanding-the-bc127-bluetooth-module
Any Bluetooth module that acts as an A2DP Sink should work with both iOS and Android.
The specific Bluetooth version that the module implements is not important (as long as it's higher than 2.1), but it needs to be an A2DP Sink (which is only possible over classic Bluetooth)

Resources