alsa tool arecord 在 Arch Linux 上无法识别 plughw:1,0

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

编辑:所有这一切都可能是由于麦克风配置错误(或有故障的麦克风,我更换了笔记本电脑,现在使用 Ubuntu 而不是 Arch Linux,所以我实际上没有有什么想法)。要录制到 wav 文件,我现在所做的就是 运行:

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

...将 $DURATION 替换为以秒为单位的录制持续时间,并将 $OUTPUT_FILE_PATH 替换为要写入的所需文件的路径。我省略了 -D sysdefault 参数,因为它给我带来了问题(与大多数事情一样,您的里程可能会有所不同,因此如果该命令对您不起作用,请尝试使用多个变量直到它起作用)。

不言而喻,但所有这些都需要 alsa-utils 安装。

(原题留在下面,还想看的朋友)


Tl;dr version:arecord 无法识别 plughw:1,0 ,也无法识别 hw:1,0 ,也无法识别 - D选项

整个故事:我正在尝试使用 Bash 脚本制作一个简单的语音助手(我发现 Python/Perl 对我来说并不容易使用,但我就是这样)。对话在 Zenity/KDialog 中进行。语音识别尚未包括在内,因此必须输入 phrase/command。目前该程序以西班牙语表示,但我也计划有一个英语版本。

通过研究,我发现:http://blog.oscarliang.net/raspberry-pi-voice-recognition-works-like-siri/

但它在我的机器上无法正常工作。

    [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 ~]$

显然与 arecord -D "plughw:1,0" -q -f cd -t wav 部分有关。

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

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 ~]$

按照@CharlesDuffy 回答的第一部分(感谢您的帮助):

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

按照@CharlesDuffy 的新回答(虽然我认为这个系统全是 AMD,没有英特尔):

   [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 ~]$ 

关注@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 ~]$ 

仔细检查了内部麦克风的音量,似乎选择了一个不存在的麦克风。切换到真实麦克风产生了相同的结果。

我现在迷路了。还有其他想法吗?是否有任何其他可能有效或更易于使用(至少对我而言)的命令行录音工具?

机器:HP 2000 笔记本电脑,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

plughw:1,0 建议特定于 Raspberry Pi 硬件,不一定适用于其他地方。

我建议的第一件事是完全删除 -D DEVICE 参数。


如果这不起作用,我建议尝试:

-D sysdefault

...用于您的基本板载音频,如 arecord -L 所列。