Mriswithe
Posts: 4
Joined: Mon May 20, 2019 6:34 am

RPi-0W Bluetooth A2DP can't set as default, but works if used directly

Mon May 20, 2019 6:49 am

Hardware/Software:

Code: Select all

RPI Zero - W
Raspbian Stretch lite install.
root@raspberrypi:~# uname -a
Linux raspberrypi 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l GNU/Linux
Trying to set up as a google-assistant using Bluetooth, currently working to get it working with a BT Headset before I buy any hardware I didn't already own.

Following this guide:

https://www.instructables.com/id/DIY-Go ... -Raspberr/

Can connect to the pi, I have the BT Headset paired, and trusted. The odd part is that if as root I run:

Code: Select all

aplay foo.wav
It comes out the bluetooth headset.

However the same command for the pi user tries to use something else, and acts like it is successfully playing, but if I specify the device, works just fine.

Code: Select all

aplay foo.wav  -D speaker
This is with no /etc/asound.conf and my .asoundrc contains the following (Note the MAC is correct for my device):

Code: Select all

ipcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug slave { pcm "hw:1,0" }
}
pcm.speaker {
  type plug
  slave.pcm {
    type bluealsa device "E8:07:BF:38:7F:C7"
    profile "a2dp"
  }
}
Which reads to me like I am using the bluealsa device as the default. Been bashing my face at this and google for awhile. Can someone tell me what I am doing dumb here? Obviously since I can get audio out of the BT headset if I specify the device it is able to use it, but I can't make it the default for some reason?

Any tips/questions/pointers would be greatly appreciated!

Thanks,
Mriswithe

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: RPi-0W Bluetooth A2DP can't set as default, but works if used directly

Mon May 20, 2019 11:50 am

Is the 'ipcm' in your .asoundrc file a typo in your post or in the file?

Have you tried the standard .asoundrc contents:

Code: Select all

defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "xx:xx:xx:xx:xx:xx"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

Mriswithe
Posts: 4
Joined: Mon May 20, 2019 6:34 am

Re: RPi-0W Bluetooth A2DP can't set as default, but works if used directly

Mon May 20, 2019 2:33 pm

Was a typo in the file, good eye. Though I removed the typo and still no love. Also to be clear, you mean my entire .asoundrc should be:

Code: Select all

defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "E8:07:BF:38:7F:C7"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000
Correct?

Once I replaced it with that it is still failing, but now the -D speaker doesn't function, as it doesn't exist. Just acts like it is playing the sound, then returns to the prompt. Same behavior even after a reboot. Though now -D bluealsa works. So confused as to why this isn't willing to take a BT device as the default.

Thanks for the questions/suggestions though!

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: RPi-0W Bluetooth A2DP can't set as default, but works if used directly

Mon May 20, 2019 2:45 pm

Yes, I intended that as a test, as it doesn't include the 'speaker' or 'mic' designations. I'm sorry, I don't understand why you're not defaulting to the BlueALSA device, or why the root user IS.

Mriswithe
Posts: 4
Joined: Mon May 20, 2019 6:34 am

Re: RPi-0W Bluetooth A2DP can't set as default, but works if used directly

Mon May 20, 2019 11:32 pm

Hey thanks for the attempt! It is funny, I am a sysadmin by day, been in the field damn near a decade, but there are still things in Linux that are outside of my knowledge and hard for me to troubleshoot. I can write distributed python jobs, orchestrate with Terraform, Packer, or ansible, do all those things, but pulseaudio defeats me so far haha.

Mriswithe
Posts: 4
Joined: Mon May 20, 2019 6:34 am

Re: RPi-0W Bluetooth A2DP can't set as default, but works if used directly

Wed May 22, 2019 1:36 am

Ok so I tried it on a RPi3 I had, and it worked. So on a hunch, I wiped the SD card I was using for the zero, reinstalled, and now the same config works... because reasons????

At least I can move on with my life.

Return to “Troubleshooting”