Configuring Sound on Linux/Pulse Audio/Testing

From Wikibooks, open books for an open world
< Configuring Sound on Linux
Jump to: navigation, search

To test a PulseAudio installation use pacat which is equivalent to ALSA's aplay utility.

 cat /dev/urandom | pacat


Using pacmd[edit]

Firstly run pacmd.

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


Next run the command 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>

Now you know the name of your sink and your index. In this example the name is alsa_output.pci_8086_27d8_sound_card_0_alsa_playback_0, and the index is 0. Now you will want a list of samples, use list-samples to accomplish this.

>>> 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

Now you can use the command play-sample followed by the name of the sample, and the index or the sink-name to test your PulseAudio configuration.

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