4

I'm trying to configure my Raspberry Pi (model B) to work as an AirPlay to Bluetooth bridge of sorts. I'm using Shairport-Sync to receive the AirPlay audio successfully, and can get it to output via Alsa to either the built-in minijack or a USB sound card, and I've got Bluetooth mostly-working, but I'm struggling to connect the dots.

I've configured ~/.asoundrc so I can connect to my Bluetooth speaker successfully, and can play audio via mplayer using the command mplayer -ao alsa:device=bluetooth audiofile.mp3, but I can't get any output via aplay.

In trying to get aplay to work too, I've discovered that my Bluetooth audio device appears when I enter the command aplay -L, but it doesn't when I do aplay -l.

So what's the difference? Why does it show in one but not the other?

I think if I can understand this, I might be able to play audio via aplay on the command line, and if I can do that, I should be able to get Shairport-sync to output to my Bluetooth speakers too!

Can anyone share some knowledge with me?

Thanks!

2 Answers 2

2

As per the manual page (which should be installed, read man aplay):

-l, --list-devices
    List all soundcards and digital audio devices
-L, --list-pcms
    List all PCMs defined

PCM is the standard way that uncompressed digital audio is encoded for playback. It may colloquially refer to a source/sink of such a signal ("PCM interface" might be clearer), which usually requires a hardware clock to work, hence they cannot be created arbitrarily. Some sound cards and devices may have multiple PCMs available.

Conversely, you may have a PCM available to the system which isn't really local. There's still a clock involved with the timing, but in this case it would be the clock for the transmitter/receiver, which isn't actually a "digital audio device".

This explanation is conjectural on my part, but fits the facts.

2
  • Thank you for replying so quickly! I checked the manual already and got what you posted, but it didn't really mean a lot to me. So does that mean I need to somehow make my Bluetooth PCM a child of a hardware sound device to get aplay to work, or is that barking up the wrong tree?
    – Trickartt
    Commented Feb 9, 2016 at 18:27
  • Dunno. Seems like CL's answer is more pragmatic. You might check the levels with alsamixer -D xxx (where xxx is as per CL).
    – goldilocks
    Commented Feb 9, 2016 at 18:31
2

aplay -l lists all hardware devices, i.e., devices handled by an ALSA kernel driver. These devices, identified by card number x and device number y, can be accessed directly with a device name hw:x,y. Software plugins that are layered on top of hardware device also accept these numbers, e.g., plughw:x,y or dmix:x.

aplay -L lists the ALSA device names of all hardware and software devices (that are configured to be listed).

To use device name xxx with aplay, run aplay -D xxx.

2
  • Thank you for replying so quickly! So why is there a distinction between the two? I was indeed trying aplay -D bluetooth filename.mp3, which says 'playing raw data' but doesn't actually make any sounds, unlike mplayer. Any ideas what I'm overlooking?
    – Trickartt
    Commented Feb 9, 2016 at 18:23
  • aplay does not support MP3 files.
    – CL.
    Commented Feb 9, 2016 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.