arkq / bluez-alsa

Bluetooth Audio ALSA Backend
MIT License
863 stars 189 forks source link

Problem with setup/integration of bluez-alsa for input sound device within Darkice #76

Closed SuperSam56 closed 6 years ago

SuperSam56 commented 6 years ago

Hi, Could you tell me if all of this is either a limitation of bluez_alsa possibilities, or Darkice input device possibilities, or am i wrong in the way to configure darkice.cfg / .asoundrc file?

Let me describe the situation:

I simply want to setup a bluetooth phone device ("AC:EE:9E:2B:52:EB") as an audio source device within Darkice. I'm using the last version of Raspbian (Stretch) for which bluetooth audio is managed natively with bluez-alsa package. i am very please with bluez-alsa which is very simple to use. And i don't want to install Pulseaudio if not required. I am able to use arecord function with for instance arecord -D test -f cd test.wav (which work perfectly when i run aplay test.wav after, the sound recorded from my bluetooth phone is playing)

"test" refers here to modifications i made in home/pi/.asoundrc file like:

pcm.test {
    type plug
    slave.pcm {
        type bluealsa
        device "AC:EE:9E:2B:52:EB"
        profile "a2dp"
    }
}

But then when I refer "test" device in [input] section of darkice.cfg file. device = test Unfortunaltely this is not working and got the following messages:

Using config file: /home/pi/darkice.cfg
Using ALSA DSP input device: test
Using POSIX real-time scheduling, priority 4
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM test
DarkIce: DarkIce.cpp:1273: can't open connector [0]

By the way, when i read @Arkq comments in https://github.com/Arkq/bluez-alsa/issues/32 (feb 12th 2017) :+1: "one might use ALSA configuration file (e.g. ~/.asoundrc) to mark PCM device to be shown in the aplay listing" I have the impression to have done what to be done. Unless i'm wrong.

And when i read litterature about darkice on internet, it seems to work with Pulseaudio (which i want to avoid installing)

Many thanks for you help to investigate my issue.

SuperSam56 commented 6 years ago

Hi @Arkq i solved my issue by just adding your README.md instructions:

defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "AC:EE:9E:2B:52:EB"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

NOT in the /.asoundrc per-user configuration file BUT rather in the /etc/asound.conf system configuration file.

indeed, it seems that the /.asoundrc is dynamically overrided by some events (such as switching the audio output to a bluetooth headset) and hence the source device was not recognized any more due to these unwanted overrides. (you maybe should add some info in your README.me) Anyway, with this setup it works perfectly with Darkice