How to fix audio configuration for aplay while using pulseaudio

10,417

Pulseaudio grabs all available ALSA hardware devices. That means as long as Pulseaudio runs, you can neither record from nor play to hw:... and plughw:....

However, the usual configuration for Pulseaudio includes a compatibility layer for ALSA applications. It looks similar to

pcm.!default pulse
ctl.!default pulse

in your ~/.asoundrc (or system-wide settings).

This means all ALSA applications using default will be redirected to Pulseaudio, with the ability to choose devices via pavucontrol etc.

So: (1) either use arecord -D pulse, arecord -D default or similar, or (2) use parecord in the first place, or (3) stop Pulseaudio or use pasuspender.

Share:
10,417

Related videos on Youtube

vv01f
Author by

vv01f

Updated on September 18, 2022

Comments

  • vv01f
    vv01f over 1 year

    I want to record audio with arecord. The same on audacity works fine.

    So after trying to record like documented:

    arecord -f dat -d 5 -D plughw:0,0 /tmp/test.wav

    failing with message: arecord: main:788: audio open error: No such file or directory

    I try to simply play audio: at /dev/random | aplay -f S16_LE failes as well with

    ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
    aplay: main:788: audio open error: No such file or directory
    

    … what am I doing wrong; or is pulseaudio the problem somehow that runs as well?

    My device list with arecord -L:

    null
        Discard all samples (playback) or generate zero samples (capture)
    default:CARD=PCH
        HDA Intel PCH, ALC269VB Analog
        Default Audio Device
    sysdefault:CARD=PCH
        HDA Intel PCH, ALC269VB Analog
        Default Audio Device
    front:CARD=PCH,DEV=0
        HDA Intel PCH, ALC269VB Analog
        Front speakers
    dmix:CARD=PCH,DEV=0
        HDA Intel PCH, ALC269VB Analog
        Direct sample mixing device
    dsnoop:CARD=PCH,DEV=0
        HDA Intel PCH, ALC269VB Analog
        Direct sample snooping device
    hw:CARD=PCH,DEV=0
        HDA Intel PCH, ALC269VB Analog
        Direct hardware device without any conversions
    plughw:CARD=PCH,DEV=0
        HDA Intel PCH, ALC269VB Analog
        Hardware device with all software conversions
    

    alsamixer "lists" (with F6):

    - default
    0 HDA Intel HDMI
    1 HDA Intel PCH
    
    • Admin
      Admin about 7 years
      arecord is with ALSA, parecord is with pulseaudio give it a try instead
  • Dom UIXNZ
    Dom UIXNZ over 6 years
    Thanks, this answer finally helped be get my usb mic working alongside the speaker pHat