【问题标题】:PulseAudio does not detect sound cards on RaspBMCPulseAudio 未检测到 RaspBMC 上的声卡
【发布时间】:2013-09-25 00:21:29
【问题描述】:

我正在尝试将来自 raspbmc(在 Raspberry Pi Model b 上运行)的默认音频输出录制到原始 wav 流(我想通过管道传输到 piFM 以将音频传输到 FM 调谐器)。 我使用arecord没有成功,发现raspbmc的默认音频引擎是pulseaudio,所以我尝试使用parecord/pacat

我的 pi 通过 HDMI 连接到电视并且声音正常。 但是pactl list 只给了我以下接收器/源:

Sink #0
        State: SUSPENDED
        Name: auto_null
        Description: Dummy Output
        Driver: module-null-sink.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 4
        Mute: no
        Volume: 0: 100% 1: 100%
                0: 0.00 dB 1: 0.00 dB
                balance 0.00
        Base Volume: 100%
                     0.00 dB
        Monitor Source: auto_null.monitor
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Dummy Output"
                device.class = "abstract"
                device.icon_name = "audio-card"
        Formats:
                pcm

Source #0
        State: SUSPENDED
        Name: auto_null.monitor
        Description: Monitor of Dummy Output
        Driver: module-null-sink.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 4
        Mute: no
        Volume: 0: 100% 1: 100%
                0: 0.00 dB 1: 0.00 dB
                balance 0.00
        Base Volume: 100%
                     0.00 dB
        Monitor of Sink: auto_null
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Monitor of Dummy Output"
                device.class = "monitor"
                device.icon_name = "audio-input-microphone"
        Formats:
                pcm

另外aplay给我:

pi@raspbmc:~$ aplay -l
aplay: device_list:252: no soundcards found...

pi@raspbmc:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)

尝试从默认设备录制音频时,不会录制任何内容。 当我尝试使用 paplay 播放声音时,什么都没有播放(没有错误,只是没有声音)。

那么我在这里错过了什么?我只需要将所有播放的声音发送到另一个程序...

我在 google 以及论坛、wiki 和博客上花了几个小时,但还没有找到适合我的设置的解决方案。

提前致谢!

编辑: /dev/audio 在 raspbmc 上不存在,/dev/snd 仅包含条目“计时器”

【问题讨论】:

  • 到目前为止,您找到解决此问题的方法了吗?

标签: audio raspberry-pi alsa pulseaudio


【解决方案1】:

您可能需要为声音设备加载内核模块,如下所示:

# modprobe snd-bcm2835

这将导致一些新设备文件出现在/dev/snd/ 中,pulseaudio 将检测为卡#0。如果我理解正确的话,这个设备是一个让pulseaudio通过ALSA输出声音的层。将其添加到您的 /etc/modules 以使其在启动时自动加载。

在我的设置中,ALSA 默认通过 HDMI 输出声音。如果没有,或者您希望将其更改为唱机插孔,您可以使用amixer 命令:

$ amixer cset numid=3 <output>

0=auto
1=headphones
2=hdmi

来源:http://www.raspberrypi.org/forums/viewtopic.php?f=38&t=27019。与他们的示例相比,我可以以非特权用户 pi 的身份执行此命令,而不是 root。

【讨论】:

    【解决方案2】:

    我已经为此奋斗了大约一个星期。尽管在我的 linux-menuconfig 中为 snd_bcm2835 启用了 ALSA。

    pi@raspi:~$ aplay -l
    aplay: device_list:250: no soundcards found...
    

    # aplay output.wav 
    ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
    ALSA lib conf.c:4528:(_snd_config_evaluate) function 
    snd_func_card_driver returned error: No such file or directory
    ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
    ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat 
    returned error: No such file or directory
    ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name 
    ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer 
    returned error: No such file or directory
    ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file 
    or directory
    ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
    aplay: main:788: audio open error: No such file or directory
    

    这个已修复:

    尝试将 dtparam=audio=on 添加到 /boot/config.txt

    来源:非常感谢 fzinken >> Alsa doesn’t work on my Raspberry Pi 2/3

    【讨论】:

      猜你喜欢
      • 2012-01-09
      • 1970-01-01
      • 2019-01-21
      • 2014-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-05
      相关资源
      最近更新 更多