Using PulseAudio and Bluez to capture real time audio
by thatlinuxguy from LinuxQuestions.org on (#5MJ6K)
Hello, I am currently working on a noise cancelation project. One requirement of this project is to connect to two different Bluetooth headphones, get their data, and output filtered data back to them. In order to go about doing this, I need some help using PulseAudio and Bluez.
I've done some research on the two and know that PulseAudio is an A2DP server and Bluez handles everything Bluetooth-related. I also know you perform commands such as: aplay -D bluealsa /usr/share/scratch/Media/Sounds/Animal/Crickets.wav and bluealsa-aplay 64:BC:0C:F6:22:F8. But these are clearly not in real-time and wouldn't suffice for my current situation. I need to capture this audio data in real-time so I can perform noise cancelation on the incoming signals which the PulseAudio server will receive on my Pi3B which runs Raspbian. I'm trying to capture this data in Python and I think it's possible to do somehow using the PulseAudio API which I know can be accessed through Dbus. Any help would be truly appreciated and if you need more information I will gladly fill you in, thanks :)
I've done some research on the two and know that PulseAudio is an A2DP server and Bluez handles everything Bluetooth-related. I also know you perform commands such as: aplay -D bluealsa /usr/share/scratch/Media/Sounds/Animal/Crickets.wav and bluealsa-aplay 64:BC:0C:F6:22:F8. But these are clearly not in real-time and wouldn't suffice for my current situation. I need to capture this audio data in real-time so I can perform noise cancelation on the incoming signals which the PulseAudio server will receive on my Pi3B which runs Raspbian. I'm trying to capture this data in Python and I think it's possible to do somehow using the PulseAudio API which I know can be accessed through Dbus. Any help would be truly appreciated and if you need more information I will gladly fill you in, thanks :)