How to handle voice from Bluetooth? - linux

I am working on a Raspberry pi based embedded project which turn a raspberry pi to a bluetooth based voice processing system. I have a BLE mic and BLE receiver connected to the RPI, I have BlueZ integrated to my stack. I am able to connect both together. But the problem I am facing now is in handling Audio from the mic. I don't have ALSA or pulse audio in my system. Is there a way to get PCM data from the bluez stack directly? it would be helpful if there is a architecture for handling voice with BLE.

Related

PCM data handling with Raspberry 4 and audio codec (TLV320AIC3104)

I´m working on a project with a Raspberry 4 compute module and IO board.
This is a schema of the project:
https://drive.google.com/file/d/1mg5IhAKTUE2Athzafis1KSsEJS1T7DXG/view?usp=sharing
I have to handle audio and voice to make calls with the raspberry. My setup consists of an audio box, which has a headset connected to it, pass the signal through a TLV320AIC3104 audio codec connected via PCM to the raspberry, and then make calls through a USB modem, which has an integrated audio card. I need two way communication.
So far, I can make the calls with the raspberry and have audio and voice with the caller, using a USB headset.
I am using the TLV320AIC3104EVM-K evaluation board (https://www.ti.com/lit/ug/slau218a/slau218a.pdf?ts=1664262721095&ref_url=https%253A%252F%252Fwww.ti.com%252Ftool%252FTLV320AIC3104EVM-K) to learn how to connect the audio codec to the raspberry, but so far I have been unable to get anything. When the TLV320AIC3104EVM-K is connected to the PC via USB I can use the headset passing through the audio box without problems.
The thing is I can´t figure out how to connect the audio codec to the raspberry to get the headset audio, and then finish the setup passing the information to the modem and back.
I understand that the connection between the TLV320AIC3104EVM-K and the Raspberry is actually an I2S connection. I have connected the GPIO PCM ports (GPIO 18, 19, 20, 21). I have configured the raspberry in the file /etc/asound.conf to have the card0 as default, being this card the one from the modem.
/etc/asound.conf
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
And have the GPIO ports configured to ALT0.
What am I missing here?

Bluetooth Speaker support with Bluez 4.101

I would like to know if audio streaming using external bluetooth speaker is supported with bluez 4.101.
I have tried the same using bluez 5.43 on Raspberry Pi and it works well with bluetoothctl and aplay.
However,I could not find bluetoothctl in bluez 4.101 and on connecting with rfcomm command, I am unable to stream music even when the speaker is connected.
Finally, I need to bring in the streaming feature on OpenWRT platform, so it would be really helpful if anyone could provide any leads on this.

Not able to pair Raspberry Pi 3 and iBeacon using Bluetooth

In my current project, I am working with iBeacon in the area of IoT. Basically iBeacon works on Bluetooth wireless technology. I am using Raspberry Pi 3 (which is available with in-built wifi and bluetooth). Pi 3 Bluetooth display and detect the iBeacon but not able to do pairing with it and display the following error:
GDBus.Error:org.bluez.Error.AuthenticationFailed
I also tried with bluetoothctl command also but again display the Failed to pair: org.bluez.Error.AuthenticationFailed
error.
Am I missing something? I am able to pair iBeacon with my mobile and windows based lapotop.
Understand that iBeacon is a transmit only Bluetooth LE device. It is Bluetooth LE manufacturer advertisements to send a unique identifier, something you have seen if you have detected it with the Raspberry Pi 3.
But a basic iBeacon device is not designed to be connectable over Bluetooth LE. Some beacon manufacturers may expose a secondary configuration service that is connectable, but this is not universal and if it exists it is entirely outside the beacon spec.
Bottom line: you are not supposed to be able to connect.
If you have a specific model of beacon that does have a config interface, and you want to connect to that, you may want to put that in your question.

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.

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