Electronic – How does the sound card process different incoming audio signals before outputting to the same speaker simultaneously

audiosound card

Below is a primitive representation of audio flow in a PC:

schematic

simulate this circuit – Schematic created using CircuitLab

A program executes a code, after many steps in binary/transistor level finally the audio is sent from the CPU to the soundcard in digital domain. The sound card then processes this incoming information to analog signal and amplifies and outputs to a speaker.

Knowing that the CPU is a serial processor, how come we can still hear several different sounds from the speaker as they are distinct. Somehow the soundcard does not mix simultaneous incoming audio data. And most confusingly imagine one executes three programs where all outputs different audio. But at the end there is one single current passes through the speaker.

What is that current composed of? Is that the addition of three different waveforms? If so are they added in soundcard or before? Is sound card parallel processing and adding them at the end?

Best Answer

... how come we can still hear several different sounds from the speaker as they are distinct.

Each ear hears the sum of the sound pressure oscillations on the eardrum. There is only one signal felt by the eardrum yet our brains can clearly identify the multiple sources in a musical piece or a voice over background noise.

Analog electrical sound signals are exactly that - an analog. The voltage rises and falls as an analogy of the sound pressure on the microphone, etc.

enter image description here

Figure 1. Three individual sinewaves and their sum. If you hit three different frequency tuning forks the sines would represent the audio waveform from each and the yellow curve would represent the sum of those reaching the ear. In their electrical form the process is the same.

Somehow the soundcard does not mix simultaneous incoming audio data.

Yes it does.

And most confusingly imagine one executes three programs where all outputs different audio. But at the end there is one single current passes through the speaker.

The sound card sums the signals it receives. For audio at CD quality the soundcard will do a digital to analog conversion at > 40 kHz so the three data streams would have to arrive at that frequency too. Each sample from each source would be buffered (as they are coming in serially in your example), summed and converted to an analog output sample.

What is that current composed of? Is that the addition of three different waveforms? If so are they added in soundcard or before?

Generally it would be done digitally but there could be an analog mixer for special applicatons.

Is sound card parallel processing and adding them at the end?

For a simple sum of three signals it would: Buffer all the inputs for one sample. Sum them. Output the analog value of the sum. It can get way more complicated than that however. Your Windows audio mixer, for example, allows you to adjust the volume of each sound source so there would be some multiplication taking place on each signal before the summation. Tone controls would add another layer of increasing complexity and any time dependent effects such as reverb, echo, chorus, pitch-change, etc., would require much more computation on each signal before conversion to analog.

enter image description here

Figure 2. Sound card block diagram by Alexander Pimpas.

The random web image above shows several features. I can't vouch for its accuracy or age.

  • Note that the audio in and audio out are connected to an audio mixer. This implies that the mic, line in or CD audio out could be fed to the audio out without any digital processing. They could also be mixed with the digital audio.
  • We can see ACD (analog to digital) and DAC (digital to analog) blocks interfacing the digital and analog domains.
  • The Waveblaster is a MIDI synthesiser which will generate synthetic instruments based on the MIDI data.