Search code examples
linuxalsa

alsa tool arecord not recognizing plughw:1,0 on Arch Linux


Edit: All of this was probably caused by a terribly configured microphone (or a faulty one, I changed laptops and now use Ubuntu instead of Arch Linux, so I actually don't have any idea). To record to a wav file, all I do now is run:

arecord -d $DURATION -f cd -t wav $OUTPUT_FILE_PATH

...replacing $DURATION with the duration of the recording in seconds, and $OUTPUT_FILE_PATH with the path to the desired file to write. I omitted the -D sysdefault argument as it caused problems for me (as with most things, your mileage may vary, so if the command doesn't work for you, try playing with several variables until it works).

Goes without saying, but all of this requires alsa-utils to be installed.

(The original question is left below, for those that still want to see it.)


Tl;dr version: arecord not recognizing plughw:1,0 , nor hw:1,0 , nor anything without the -D option

Whole story: I'm trying to make a simple voice assistant using a Bash script (I don't find Python/Perl easy for me to use, but that's just me). Dialogs are made in Zenity/KDialog. Voice recognition isn't included yet, so one has to type in the phrase/command. For now the program is represented in Spanish, but I plan to have an English version as well.

Doing my research, I found: http://blog.oscarliang.net/raspberry-pi-voice-recognition-works-like-siri/

But it doesn't work correctly on my machine.

    [owner@arch-hp-2000-notebook-pc ~]$ ~/test-speech-input 
    “Recording… Press Ctrl+C to Stop.”
    ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM “plughw:1,0″
    arecord: main:722: audio open error: No such file or directory
    “Processing…”
    ^C
    [owner@arch-hp-2000-notebook-pc ~]$

It apparently has to do with the arecord -D "plughw:1,0" -q -f cd -t wav part.

Output of arecord -l:

    [owner@arch-hp-2000-notebook-pc ~]$ arecord -l
    **** List of CAPTURE Hardware Devices ****
    card 1: Generic_1 [HD-Audio Generic], device 0: ALC269VC Analog [ALC269VC Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

Output of arecord -L:

    [owner@arch-hp-2000-notebook-pc ~]$
    null
        Discard all samples (playback) or generate zero samples (capture)
    pulse
        PulseAudio Sound Server
    default
        Default ALSA Output (currently PulseAudio Sound Server)
    sysdefault:CARD=Generic_1
        HD-Audio Generic, ALC269VC Analog
        Default Audio Device
    front:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        Front speakers
    surround21:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        2.1 Surround output to Front and Subwoofer speakers
    surround40:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        4.0 Surround output to Front and Rear speakers
    surround41:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    surround71:CARD=Generic_1,DEV=0
        HD-Audio Generic, ALC269VC Analog
        7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    [owner@arch-hp-2000-notebook-pc ~]$

Following the first part of the answer by @CharlesDuffy (thanks for the help):

    [owner@arch-hp-2000-notebook-pc ~]$ ~/test-speech-input 
    Recording… Press Ctrl+C to Stop.
    Processing…
    You Said: [owner@arch-hp-2000-notebook-pc ~]$

Following the new answer, also by @CharlesDuffy (although this system is all AMD I think, no intel):

   [owner@arch-hp-2000-notebook-pc ~]$ test-speech-input
    Recording… Press Ctrl+C to Stop.
    ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM CARD=Generic_1
    arecord: main:722: audio open error: No such file or directory
    Processing…
    You Said: [owner@arch-hp-2000-notebook-pc ~]$ 

Following the newest answer by @CharlesDuffy:

    [owner@arch-hp-2000-notebook-pc ~]$ 
    Recording… Press Ctrl+C to Stop.
    ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
    arecord: main:722: audio open error: No such file or directory
    Processing…
    ^C
    [owner@arch-hp-2000-notebook-pc ~]$ 

Double-checked the volume of the internal mic, and it seemed to have selected a non-existent mic. Switching to the real mic yielded the same results.

I'm lost right now. Any other ideas? Is there any other command-line voice recording tool that might work or that might be easier to use (at least for me)?

Machine: HP 2000 Notebook PC, Arch Linux, uname -a returns Linux HOST_NAME 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015 x86_64 GNU/Linux


Solution

  • The plughw:1,0 suggestion is specific to Raspberry Pi hardware, and doesn't necessarily apply elsewhere.

    The first thing I'd suggest is removing the -D DEVICE argument entirely.


    If that doesn't work, I'd suggest trying:

    -D sysdefault
    

    ...for your basic on-board audio, as listed by arecord -L.