跳转到内容

在 Linux/Pulse Audio 上配置声音/测试

来自 Wikibooks,开放世界中的开放书籍

要测试 PulseAudio 安装,请使用pacat它相当于 ALSA 的aplay实用程序。警告:此命令的输出可能非常大声。

 pacat < /dev/urandom

使用 pacmd

[编辑 | 编辑源代码]

首先运行pacmd.

~$ pacmd
Welcome to PulseAudio! Use "help" for usage information.

接下来运行命令list-sinks.

>>> list-sinks
1 sink(s) available.
  * index: 0
        name: <alsa_output.pci_8086_27d8_sound_card_0_alsa_playback_0>
        driver: <modules/module-alsa-sink.c>
        flags: HW_VOLUME_CTRL LATENCY HARDWARE 
        state: RUNNING
        volume: <0:  63% 1:  63%>
        mute: <0>
        latency: <78911 usec>
        monitor source: <1>
        sample spec: <s16le 2ch 44100Hz>
        channel map: <front-left,front-right>
        used by: <1>
        linked by: <1>
        module: <1>
        description: <ALSA PCM on front:0 (AD198x Analog) via DMA>

现在您知道您的接收器名称和索引。在这个例子中,名称是alsa_output.pci_8086_27d8_sound_card_0_alsa_playback_0,索引是 0。现在您需要样本列表,使用list-samples来完成这个操作。

>>> list-samples
3 cache entries available.
    name: <pulse-hotplug>
        index: <0>
        sample spec: <n/a>
        channel map: <n/a>
        length: <0>
        duration: <0.0s>
        volume: <0: 100% 1: 100%>
        lazy: yes
        filename: /usr/share/sounds/startup3.wav
    name: <esound.gnome-2/logout>
        index: <1>
        sample spec: <s16le 2ch 44100Hz>
        channel map: <front-left,front-right>
        length: <317500>
        duration: <1.8s>
        volume: <0: 100% 1: 100%>
        lazy: no
        filename: n/a
    name: <esound.gnome-2/login>
        index: <2>
        sample spec: <s16le 2ch 44100Hz>
        channel map: <front-left,front-right>
        length: <1361924>
        duration: <7.7s>
        volume: <0: 100% 1: 100%>
        lazy: no
        filename: n/a

现在您可以使用命令play-sample然后是样本名称,以及索引或接收器名称来测试您的 PulseAudio 配置。

>>> play-sample pulse-hotplug 0
-or-
>>> play-sample pulse-hotplug alsa_output.pci_8086_27d8_sound_card_0_alsa_playback_0


华夏公益教科书