1

I've found several candidate dupes for this - the one that seems to encompass them all (and more) being this one: How can I use an external USB sound-card and set it as default?

But none of them have helped.

I have a brand new Pi 4, with Raspbian Buster installed via NOOBS 3.3.1 today.

I have plugged in a small external USB speaker, and tried the instructions in the great answer to the above question, as well as the advice on the adafruit page, for Raspbian Stretch.

In all cases, when I try speaker-test -c2 I get a click sound from the speakers, followed by:

Write error: -19,No such device

The speakers work fine when plugged into a different computer, and I consistently see the speakers listed when I run aplay -l:

...
card 1: Device [USB2.0 Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
...

Before making any changes, with the /usr/share/alsa/alsa.conf file still showing:

defaults.ctl.card 0
defaults.pcm.card 0

I could run speaker-test -c2 and hear audio through my monitor's speakers, via HDMI.

Having changed the above values to 1, when I run it I get the error shown above.

Trying a random .wav file through mplayer is no more successful:

mplayer http://www2.cs.uic.edu/~i101/SoundFiles/BabyElephantWalk60.wav
MPlayer 1.3.0 (Debian), built with gcc-8 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://www2.cs.uic.edu/~i101/SoundFiles/BabyElephantWalk60.wav.
Resolving www2.cs.uic.edu for AF_INET6...

Couldn't resolve name for AF_INET6: www2.cs.uic.edu
Resolving www2.cs.uic.edu for AF_INET...
Connecting to server www2.cs.uic.edu[131.193.32.16]: 80...

Cache size set to 320 KBytes
Cache fill: 12.44% (40764 bytes)   

libavformat version 58.20.100 (external)
Audio only file format detected.
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 22050 Hz, 1 ch, s16le, 352.8 kbit/100.00% (ratio: 44100->44100)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   2.0 (02.0) of 60.0 (01:00.0)  0.3% 48% 
[AO_ALSA] alsa-lib: pcm_hw.c:585:(snd_pcm_hw_status) SNDRV_PCM_IOCTL_STATUS_EXT failed (-19): No such device
[AO_ALSA] Cannot get pcm status: No such device
[AO_ALSA] alsa-lib: pcm_hw.c:585:(snd_pcm_hw_status) SNDRV_PCM_IOCTL_STATUS_EXT failed (-19): No such device
[AO_ALSA] Cannot get pcm status: No such device

with the last two lines repeated constantly until I hit Ctrl-c.

Trying other applications to play the audio gives different errors:

aplay -c2 -D hw:1,0 BabyElephantWalk60.wav
Playing WAVE 'BabyElephantWalk60.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
aplay: set_params:1345: Channels count non available

The least unsuccessful is:

omxplayer BabyElephantWalk60.wav 
Audio codec pcm_s16le channels 1 samplerate 22050 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
have a nice day ;)

with the "have a nice day ;)" line appearing after about 60 seconds, which is the duration of the file, but no sound comes out of the speaker.

In all cases, reverting alsa.conf to the defaults of "0" and removing ~/.asoundrc causes the sound to play successfully through my monitor's speakers.

Any advice at all is most welcome. I'm guessing the issue is that I need to do something different either due to the Pi 4 or Buster, but I've no idea where to start.

5
  • This sounds as if the device shuts down because it does not get enough power.
    – CL.
    Commented May 6, 2020 at 7:38
  • @CL. I guess that's possible, but I'd have thought it's rated to work fine with the Pi's USB output as it's sold by the PiHut and has several positive reviews mentioning using it with a Pi. Unless the Pi 4's USB ports output less power than the 3? Commented May 6, 2020 at 9:21
  • A brief interim update in case anyone else is having similar problems - The Pi Hut's excellent support team have come back to me and said the setup should work, but they're going to give it a try themselves and get back to me. I'll update here when I know something more useful. Commented May 7, 2020 at 5:58
  • @DaveyDaveDave Any update?
    – pookie
    Commented Feb 16, 2021 at 18:38
  • @pookie, not really. PiHut tried the same thing with a different speaker of the same make and model, and it worked fine. I ended up returning that one and getting this instead, which works OK, but I have to keep the volume quite low or it dies. I suspect webmariner's answer below is the cause, but haven't had a chance to test it for myself yet. Commented Feb 17, 2021 at 6:40

1 Answer 1

2

I had similar problems with a USB speaker connected to a Pi 3 Model B - the speaker would click when I attempted to play a sound and then go very quiet as though it had been powered off.

I checked dmesg and it seemed like the over-current protection had been doing exactly that.

[  127.114267] usb 1-1-port2: over-current change
[  127.346880] usb 1-1.4: USB disconnect, device number 5
[  127.626207] usb 1-1.2: USB disconnect, device number 4
[  127.936772] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
...
[  160.138286] usb 1-1-port2: over-current change
[  160.376958] usb 1-1.4: USB disconnect, device number 7
[  160.650206] usb 1-1.2: USB disconnect, device number 6
[  160.956803] usb 1-1.2: new full-speed USB device number 8 using dwc_otg
...
[  193.674288] usb 1-1-port2: over-current change
[  193.906963] usb 1-1.4: USB disconnect, device number 9
[  194.186211] usb 1-1.2: USB disconnect, device number 8
[  194.486834] usb 1-1.2: new full-speed USB device number 10 using dwc_otg

I found that if I go into alsamixer and bring the volume right down from the max (using the down arrow key, then ESC to quit), then retry the aplay or speaker-test command which had been failing, it starts working. Bizarrely, putting the volume back up to max after that still seems to work okay, almost like the speaker needs more current to work first time.

I gather there are ways of disabling the USB current limiting feature in software but I suppose it's there for a reason and you probably only want to go there as a last resort and if you know the power supply you're using can cope. Hope this is useful!

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.