USB Mic stops working after installing Speaker Phat

I have a USB Mic which works fine, however, as soon as I install Speaker Phat it stops recording. When trying to do a test recording getting “audio open error: Device or resource busy”.

How can I fix this?

Thanks.

This may well be because Pulse Audio is now running and hogging any available audio devices. An unintended consequence.

Could you post the output of:

aplay -L

and

aplay -l

And what command do you use to record audio?

You should be able to record in the meantime by shutting down Pulse Audio:

sudo systemctl stop pulseaudio

Here you go:
aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default
Playback/recording through the PulseAudio sound server
pivumeter
softvol_and_pivumeter
sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac,
Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dac,
Hardware device with all software conversions
sysdefault:CARD=Device
USB Audio Device, USB Audio
Default Audio Device
front:CARD=Device,DEV=0
USB Audio Device, USB Audio
Front speakers
surround21:CARD=Device,DEV=0
USB Audio Device, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0
USB Audio Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
USB Audio Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
USB Audio Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
USB Audio Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
USB Audio Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
USB Audio Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0
USB Audio Device, USB Audio
Direct sample mixing device
dsnoop:CARD=Device,DEV=0
USB Audio Device, USB Audio
Direct sample snooping device
hw:CARD=Device,DEV=0
USB Audio Device, USB Audio
Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
USB Audio Device, USB Audio
Hardware device with all software conversions

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0

I was using arecord to test it. Ideally while stopping Pulse Audio did work, I would like to have them working at the same time.
Thanks.

Aye it’s definitely possible, I’ve just got to find which combination of config trickery is required to make Pulse leave the “Device” card alone, so that you can record as normal.

You might also find that:

arecord -D pulse

works.

Sorry for the delay in response. Still having issues getting mic and Speaker Phat working together.
arecord -D purlse did not work.
Get arecord: main:788: audio open error: No such file or directory.

This is something I’ll need to find the time to look into in more depth - Pulse is a complex beast, and I clearly haven’t understood it well enough to stop myself making a mess of the configuration and trampling all over the audio system.

Thanks. I was hoping to turn the raspberry pi into an Alexa device so need the mic and speaker to work at the same time.

I had this problem and was able to resolve it by making the following changes to the pulseaudio configuration generated by the primoroni install script:

  1. in default.pa changed the timeout value of load module module-suspend-on-idle from timeout=604800 to timeout=0.
  2. in daemon.conf added exit-idle-time = -1 to the bottom of the file.

I would like to say I had a conceptual model of what I was doing, but I do not. These fixes resulted from watching the owned file system objects of pulseaudio and guessing at what might change the behavior. There may be undesirable side effects of this.

I would like to have seen the software for the Speaker-phat in a package – ideally one that worked at the ALSA level alone, and maybe one that also incorporated pulseaudio. It is not clear to me why pulseaudio had to be changed – if really messed up our pulseaudio configuration and we are not really comfortable with using the single system wide pulseaudio daemon. That said, things are now working.

Yes, thank you. This solved it!