2

What is the difference & relation between audio sink and audio card/device?

Can a sink sink into more than 1 device of the same audio card? aka, sink-device ca be a one-to-many relation?

PS: I'm not a total noob but I'm also not very knowledgeable in Linux audio

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [LG TV SSCR2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

gst-inspect-1.0 | grep -iP "audio sink|pipewire" | more
alsa:  alsasink: Audio sink (ALSA)
autodetect:  autoaudiosink: Auto audio sink
jack:  jackaudiosink: Audio Sink (Jack)
oss4:  oss4sink: OSS v4 Audio Sink
ossaudio:  osssink: Audio Sink (OSS)
pipewire:  pipewiredeviceprovider (GstDeviceProviderFactory)
pipewire:  pipewiresink: PipeWire sink
pipewire:  pipewiresrc: PipeWire source
pulseaudio:  pulsesink: PulseAudio Audio Sink

Pipewire processing when listening to the TV connected to my KEF LSX speakers through my computer (I also use EasyEffects): enter image description here

3
  • You can think of a sink as of destination during audio processing, ex, speakers or new audio file. Commented Mar 10, 2024 at 16:50
  • I already do that but the same is true for the sound card/device :) Commented Mar 11, 2024 at 8:25
  • sound card is used for audio processing, where sink is only part of it, I posted an answer with details. Commented Mar 11, 2024 at 9:09

2 Answers 2

3

An explanation of my comment to your question...

In computing, a sink, or data sink generally refers to the destination of data flow.

snip

In several computer programs employing streams, such as GStreamer, PulseAudio, or PipeWire, a source is the starting point of a pipeline which produces a stream but does not consume any, while a sink is the end point which accepts a stream without producing any

https://en.wikipedia.org/wiki/Sink_(computing)

Therefore an audio sink is the destination of audio processing, such as speakers.

Sound card on another hand...

A sound card (also known as an audio card) is an internal expansion card that provides input and output of audio signals to and from a computer under the control of computer programs.

Sound cards use a digital-to-analog converter (DAC), which converts recorded or generated digital signal data into an analog format.

https://en.wikipedia.org/wiki/Sound_card

Sound card therefore is neither audio source nor audio destination (sink)
What sound card does is converting the digital signal.

Audio source is also known as media source ex media file.
Sound processing pipeline consists of media source to media processing software (which uses sound card) toward media sink.

See link below for an overview of Microsoft's implementation of audio processing, it mentions sinks and sources and audio processing:

https://learn.microsoft.com/en-us/windows/win32/medfound/overview-of-the-media-foundation-architecture

edit:

Audio processing on a PC is done by audio processing software and consists of an audio processing pipeline (software thing) that is similar to rendering pipeline in video game development.

In similar fashion how GPU is used for rendering in rendering pipeline (but is not a destination), so is audio card used for audio conversion but is not itself a destination of audio signal.

Sound card accepts input (ex. digital) and provides output (ex. analog) where both input and output is managed by audio processing software.
User interaction with audio software decides what audio sources and sinks (destinations) are used.

For instance if one is to use microphone for audio input, then that's audio source, if a user uses an audio file it's also an audio source.

Audio software will ofc. with the help of drivers interact with devices that are sources or destinations (ex. microphone or speakers)

Audio pipeline (software concept) starts with the source, in the case of microphone audio input is analog signal which the audio software with the help of sound card converts to digital signal in order to be usable by audio software.

Sound card is therefore an intermediate that is used solely for digital-to-analog and vice-versa audio processing which is needed for audio software because audio software deals with digital audio signal but not with analog, to understand analog signal audio software uses sound card for conversion.

Once the signal is converted by sound card the audio software will continue streaming audio signal down the pipeline toward destination aka. audio sink

Audio sink can be a new audio file (ex. if the user is recording voice and saving to file) or it can be speakers (ex. if the user is playing audio)

Audio sink is the end of an audio pipeline where source is the start of the audio pipeline.

Audio pipeline itself is managed by audio software.

Between audio source and audio sink the software is responsible for audio processing which includes using sound card for signal conversion, therefore sound card is neither a source nor destination but an intermediate unit in the audio pipeline that is used by the audio software.

Just like in rendering pipeline a GPU is neither the source nor sink for video game software but is used by the pipeline coded into game, so is sound card used in the audio pipeline by audio software.

edit2:

good to know, but who then plays the audio, i.e. send it to the output connectors? are those connectors the audio devices?

Audio pipeline breakdown:

Example: how using microphone works to listen to ones voice?

  1. A user speaks to microphone, the input to microphone is analog audio signal
  2. Audio software (or library) receives analog input signal from driver managing the microphone but does not understand analog signal
  3. Audio software then coverts analog signal input with the help of sound card driver to digital signal to be able to handle it in audio pipeline (sound card takes input and gives output - conversion)
  4. Audio software then receives and handles the converted digital signal, it then for ex. applies codecs, does mixing etc. (all with digital signal which the software is able to understand)
  5. Audio software then again uses sound card to convert digital to analog signal to be able to send it to sink (ex. speakers)
  6. This analog signal is then sent to driver managing speakers, in order for speaker to play audio the signal must be analog.

Therefore audio software uses sound card twice, first time to convert analog to digital, and then again digital to analog because hardware (microphone and speakers) don't understand digital signal but on another side audio software doesn't analog digital signal so it needs sound card for conversion to be able to handle it and send it to driver responsible for output (or receive for input).

In case of playing an audio file, the signal is already digital therefore sound card would be used only once, that is for digital to analog to be sent to drivers managing speakers. (ex. there is no analog input)

9
  • thanks, but your answer is a very shallow explanation only. I'd like to see more focus on the relationship between the sink, audio card and audio device; I don't care much about the audio source (the question is not about it) but I have nothing against it if it helps with the explanation. Commented Mar 11, 2024 at 9:30
  • "Sound card therefore is neither audio source nor audio destination (sink)." -> the sound card is a kind of destination, see the pipewire processing graph. Commented Mar 11, 2024 at 9:43
  • I don't have experience with audio in Linux or with hardware concepts of audio processing, but I don't agree that sound card is a kind of destination, I'll edit my post the best I can. Commented Mar 11, 2024 at 9:50
  • In short sound card gets input from audio software and gives output to same audio software, the software itself uses sound card for conversion, but sound card is neither source nor destination but intermediate unit in audio pipeline that's managed by audio software. Commented Mar 11, 2024 at 10:26
  • 1
    well, your answer helps a bit so I voted it up but I can't accept it as an answer because it doesn't explain the relation between the sink and audio device Commented Mar 11, 2024 at 10:45
1

Some sink refers to some flow of data. (in some particular sound-server terminology)

Without any sound server, an audio app would output its audio samples directly to the hardware audio device. No need of any sink concept in these cases.

The sink concept appeared with some particular sound server (never read it used regarding the jack audio connection kit sound server of choice.).
When a sound-server is used, the audio app sends its data to the sound server. This, according to its terminology makes one sink.
The sound server can output to the device, using that sound server terminology, this would make another sink
But it could also sink the audio samples to some post-processing application, itself sinking to the sound-server incidentally sinking to the sound device.

On a side note, that sound-server was absurdly made capable to also sink to… another sound server… :-)


From comment : "could the server output to more than 1 device the same (audio) data at the same time?"

Yes, with regards to the sound server having introduced the concept, it is possible thanks to its module-combine-sink, it would also be possible to sink the data output by the device, back as an input to some application or even to the sound-server itself thanks to the module-loopback (at the cost of a totally unacceptable latency though). Note that the same thing could be achieved more quickly without any sound server thanks to alsa virtual-devices..

6
  • In my example are 5 audio devices; "The sound server can output to the device" - could the server output to more than 1 device the same (audio) data at the same time? I find the device concept still slippery. Commented Mar 11, 2024 at 15:47
  • "the audio app sends its data to the sound server. This, according to its terminology makes one sink." - so pipewiresink or pulseaudiosink are 1 sink connected to many or one audio device? can you please explain the relation with the audio device? Commented Mar 11, 2024 at 15:49
  • @Adrian : I addressed your first question in an edit of my answer. I'll answer your second qestion later on. Commented Mar 12, 2024 at 10:01
  • module-combine-sink doesn't seem to sink to devices but to other sinks. I come to believe that it is not possible to output to multiple devices of the same audio card. If it's indeed possible to do that, i.e. output to multiple devices of the same audio card, please show how. Commented Mar 19, 2024 at 14:24
  • 1
    @Adrian : Yes it does, please consider medium.com/@joao.paulo.silvasouza/… Commented Mar 19, 2024 at 14:32

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.