Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

OK. Pre-post note; this became ugly long, - but the core of an problem is that I'm unable to find good articles or diagrams and explanations on this. There is a lot of "how too"s, but I'm having a hard time finding sources going on explaining what I ask about here. By far I guess it cooks down to terminology in 87% of the cases. Then there is, at least it seems to me, quite a few double-meanings.

So; any tips on sources to read is highly appreciated.


I'm having a look at Pulse Audio and the more I read the more confused I get. As I see it it stems down to a basic fault - and that is the understanding of the core concepts.

I'm using pactl and pacmd to look at various things but I'm having trouble getting how they all relate.

E.g. by pactl one have a list option where one can list modules, sinks, sources, sink-inputs, source-outputs, clients, samples, cards. I'm trying to figure out the base of this.

Here are my way thus far; - and I have no idea if this is correct or not and would be nice to get some hints if anything is wrong, etc.


Given the list of listables above:

  1. cards : Hardware. Each card in this list has been recognized by udev and given a sysfs.path. Pulse Audio loads modules to interact with the hardware typically Driver: module-alsa-card.c.

    1.1. Q1: Does ALSA communicate with PA or does PA use ALSA as a conduit to the hardware? Or is it a mix of the two?

    As the card is loaded into PA it gets owned by a specific indexed module. By pactl list cards one find the record Owner Module: N where N is used by the rest of the PA server. Each card can have one or more profiles and ports.

    A profile is a base configuration for the card - typically it defines if a card has output+input, only one of the two, if it is stereo or mono etc.

    A port is a conduit to or from the card. Being input or output jacks, HDMI, MIDI or other.

    1.2. Q2: My definition of ports is erroneous. I register e.g. that I have ports named output-speaker and output-headphones on same jack. What is a port then? <<- that sounds as much as a profile as a port. Perhaps even more like a profile.

  2. sinks: A sink is an output target. Write data to a sink and PA relay it as sound and as it is delivered it vanishes out the drain. The listing from pactl list sinks display a Owner Module that is the same as the one listed in cards.

    Hardware related sinks are output - as in this is delivered to your headphones, speakers or other. The naming convention is

    type_output.bus_path.output-profile         e.g.:
    alsa_output.pci-0000_00_1b.0.analog-stereo  or by udev.id:
    alsa_output.usb-08dc_C-Media.analog-stereo
    

    In addition one can have module-based sinks, or a software-sink if you like. These are typically filters that one can route the stream trough for various effects - like switching right to left channel, adding equalizer etc.

    Sinks also has ports but these are restricted to the ones relying output. E.g. analog-output-speaker.

    2.1 Q2: Are modules added to sinks, or is it the other way around? I can't seem to get it right which way. Is it typically A, B or C in (I vote for A):

    A: 'media player'->'sink'->'filter-module'->'hardware'->left the system ...
    B: 'media player'->'filter-module'->'sink'->'hardware'->left the system ...
    C: ?
    

    Each sink also has a monitor. That is related to the next listing:

  3. sources: Sources are primarily input as in recording. Typically microphone or tuner cards. Here as well the Owner Module relate to the cards listing. They have the naming by:

    type_input.bus_path.input-profile         e.g.:
    alsa_input.pci-0000_07_04.1.analog-stereo
    

    Q3.1: What is .monitor sources? As in the ones having a mother in sinks. This confuses me a bit. I also register each filter module in sinks has a monitor.

    As with sinks, sources is restricted to ports having input, e.g. analog-input-radio unless they are .monitor sources whereby they have no ports.

  4. sink-inputs : These are primarily streams the deliver data to the sinks. By their listing in pactl list sink-inputs one find typically Sink: 1 which indicate the stream are passed to sink 1.

    Q4.1: Here also module-sink driven entry. How does this fit in the chain?

  5. source-outputs: Is this recording streams?

  6. modules : Everything? Is loaded by modules.

  7. clients : What are these? All applications that has an active connection to Pulse Audio? I Find Media players, volume control, window manager etc.

  8. samples : Finally what is this? I have one entry namely "Volume Control Feedback Sound". It has no record of owning or being owned.

A short diagram displaying some of the connections. I am not sure how these arrows should go. E.g. the A-B-C-G routine. Which way and who does what?

                            Sink Input #0 module-remap-sink [Owner Module: 21]
                                                                            |
Sink Input #189 MPlayer [OwnerModule: 9, Sink: 1]                           |
                                               |                            |
   /-------------------------------------------+ A.                         |
   |                                                                        |
   V                                                                        |
Sink #1 reverse-stereo [OwnerModule: 21, master_device = alsa_output.pci-1] |
                                     ^              |                       |
                                     |              |                       |
                     +---------------+ B.           |                       |
                     |                              |                       |
                     |                              |                    C. |
             Module #21 module-remap-sink [] <------------------------------+
                   ^                                |
                   | G.                             |
                   |                                |
Source #2 reverse-stereo.monitor [Owner Module #21] |
                                                    |
                                                    |
Sink #0 alsa_output.pci-1 [Owner Module: 5] <-------+ D.
                                         |
                                         |
                +------------------------+ E.
                |
                |   Source #0 alsa_output.pci-1.monitor [OwnerModule 5]
                |                                                   |
                |                                                   |
                v                                                   |
        Module #5 module-alsa-card [device_id="0" name="pci-1"] <---+ H.
                                                 |
                                                 |
                                         +-------+ F.
                                         |
                                         v
Card #1 alsa_card.pci-1 [alsa.card = "0", device.bus_path = pci-1]
                                                     |
                                                     |
                                                     v
                                                  irq 45
share|improve this question

closed as too broad by Tog, Kevin Panko, Canadian Luke, Moses, LPChip Jul 4 at 14:32

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Samples are short sound snippets that can be loaded into memory once, then played multiple times by giving only their name. For example, this is useful for the "bell" sound. –  grawity Mar 12 '13 at 14:28
    
Q1: PulseAudio only uses ALSA to access the hardware. It uses mostly the low-level functionality; I think it skips asound.conf and other ALSA userspace components. –  grawity Mar 12 '13 at 14:30
1  
Clients are all active connections to PulseAudio. [All of this is one-third of an answer, at most, so I'm not sure I can post it as an answer yet. Maybe someone else will finish it.] –  grawity Mar 12 '13 at 14:31
    
@grawity: It is much appreciated. If not an answer per se it is good information and I'd at least give it a vote :) –  Zimzalabim Mar 13 '13 at 3:09

Browse other questions tagged or ask your own question.