public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] OT: What does the data stream to a sound card look like?
@ 2011-05-28  9:50 Alan Mackenzie
  2011-05-28 10:19 ` [gentoo-user] " Nikos Chantziaras
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Mackenzie @ 2011-05-28  9:50 UTC (permalink / raw
  To: gentoo-user

Hi, Gentoo.

It occurred to me the other day that I am clueless about how a sound
card works.  How do the data get into it?  Does the sound card use an
interrupt to ask for more data?

What form do the data take?  Say I feed an mp3 through the card.  Does
the Athlon do the decompression, or does the sound card do it?

Last of all, is there a command line program which can play a CD by
feeding its data into the sound card?

Thanks for any and all enlightenment.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-user] Re: OT: What does the data stream to a sound card look like?
  2011-05-28  9:50 [gentoo-user] OT: What does the data stream to a sound card look like? Alan Mackenzie
@ 2011-05-28 10:19 ` Nikos Chantziaras
  2011-05-28 14:13   ` Florian Philipp
  0 siblings, 1 reply; 4+ messages in thread
From: Nikos Chantziaras @ 2011-05-28 10:19 UTC (permalink / raw
  To: gentoo-user

On 05/28/2011 12:50 PM, Alan Mackenzie wrote:
> Hi, Gentoo.
>
> It occurred to me the other day that I am clueless about how a sound
> card works.  How do the data get into it?  Does the sound card use an
> interrupt to ask for more data?

The data is placed in RAM.  The card reads it from there using a DMA 
operation.  You can read about it here:

http://en.wikipedia.org/wiki/Direct_memory_access


> What form do the data take?

It's raw data, and its form depends on what the card is expecting.  What 
the card is expecting is programmable by the card's driver.


> Say I feed an mp3 through the card.  Does
> the Athlon do the decompression, or does the sound card do it?

The MP3 is decoded by your CPU (by software like libmad, xine, 
gstreamer, etc.)  The decoded data is send to the driver, the driver 
applies any needed conversions to it (according to what the card 
expects), and then places it in RAM so the card can get it by means of DMA.


> Last of all, is there a command line program which can play a CD by
> feeding its data into the sound card?

Today this works the same playing any other audio.  The fact that audio 
in this case comes from a CD doesn't matter.  An application reads the 
audio from the CD, sends it to the driver, and from there it gets to the 
sound card.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] Re: OT: What does the data stream to a sound card look like?
  2011-05-28 10:19 ` [gentoo-user] " Nikos Chantziaras
@ 2011-05-28 14:13   ` Florian Philipp
  2011-05-29 12:14     ` Alan Mackenzie
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Philipp @ 2011-05-28 14:13 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]

Am 28.05.2011 12:19, schrieb Nikos Chantziaras:
> On 05/28/2011 12:50 PM, Alan Mackenzie wrote:
>> Hi, Gentoo.
>>
>> It occurred to me the other day that I am clueless about how a sound
>> card works.  How do the data get into it?  Does the sound card use an
>> interrupt to ask for more data?
> 
> The data is placed in RAM.  The card reads it from there using a DMA
> operation.  You can read about it here:
> 
> http://en.wikipedia.org/wiki/Direct_memory_access
> 
> 
>> What form do the data take?
> 
> It's raw data, and its form depends on what the card is expecting.  What
> the card is expecting is programmable by the card's driver.
> 

Most likely it is some PCM format (pulse code modulation) not very
different from WAV, CDDA, etc. (just without headers, of course). In the
easiest case, the sound card then just feeds this into a digital-analog
converter connected to the output (together with a analog-digital
converter this is called an audio codec, for example AC'97).

AC3 or DTS, the compressed formats found on DVD, can also be "passed
through" the sound card to reach a home theater system over a digital
output without being converted into an analog signal.

> 
>> Say I feed an mp3 through the card.  Does
>> the Athlon do the decompression, or does the sound card do it?
> 
> The MP3 is decoded by your CPU (by software like libmad, xine,
> gstreamer, etc.)  The decoded data is send to the driver, the driver
> applies any needed conversions to it (according to what the card
> expects), and then places it in RAM so the card can get it by means of DMA.
> 

This can be observed in some cases when the system crashes during
playback. Then sometimes the card just seems to loop over the last data
packet placed in RAM.

> 
>> Last of all, is there a command line program which can play a CD by
>> feeding its data into the sound card?
> 
> Today this works the same playing any other audio.  The fact that audio
> in this case comes from a CD doesn't matter.  An application reads the
> audio from the CD, sends it to the driver, and from there it gets to the
> sound card.
> 

The cdparanoia FAQ provides a lot of insight into the special problems
of reading CD audio:
http://www.xiph.org/paranoia/faq.html

Regards,
Florian Philipp



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] Re: OT: What does the data stream to a sound card look like?
  2011-05-28 14:13   ` Florian Philipp
@ 2011-05-29 12:14     ` Alan Mackenzie
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2011-05-29 12:14 UTC (permalink / raw
  To: gentoo-user

Hi, Nikos and Florian.

Thanks for the helpful elucidation.

-- 
Alan Mackenzie (Nuremberg, Germany).


On Sat, May 28, 2011 at 04:13:18PM +0200, Florian Philipp wrote:
> Am 28.05.2011 12:19, schrieb Nikos Chantziaras:
> > On 05/28/2011 12:50 PM, Alan Mackenzie wrote:
> >> Hi, Gentoo.

> >> It occurred to me the other day that I am clueless about how a sound
> >> card works.  How do the data get into it?  Does the sound card use an
> >> interrupt to ask for more data?

> > The data is placed in RAM.  The card reads it from there using a DMA
> > operation.  You can read about it here:

> > http://en.wikipedia.org/wiki/Direct_memory_access


> >> What form do the data take?

> > It's raw data, and its form depends on what the card is expecting.  What
> > the card is expecting is programmable by the card's driver.


> Most likely it is some PCM format (pulse code modulation) not very
> different from WAV, CDDA, etc. (just without headers, of course). In the
> easiest case, the sound card then just feeds this into a digital-analog
> converter connected to the output (together with a analog-digital
> converter this is called an audio codec, for example AC'97).

> AC3 or DTS, the compressed formats found on DVD, can also be "passed
> through" the sound card to reach a home theater system over a digital
> output without being converted into an analog signal.


> >> Say I feed an mp3 through the card.  Does
> >> the Athlon do the decompression, or does the sound card do it?

> > The MP3 is decoded by your CPU (by software like libmad, xine,
> > gstreamer, etc.)  The decoded data is send to the driver, the driver
> > applies any needed conversions to it (according to what the card
> > expects), and then places it in RAM so the card can get it by means of DMA.


> This can be observed in some cases when the system crashes during
> playback. Then sometimes the card just seems to loop over the last data
> packet placed in RAM.


> >> Last of all, is there a command line program which can play a CD by
> >> feeding its data into the sound card?

> > Today this works the same playing any other audio.  The fact that audio
> > in this case comes from a CD doesn't matter.  An application reads the
> > audio from the CD, sends it to the driver, and from there it gets to the
> > sound card.


> The cdparanoia FAQ provides a lot of insight into the special problems
> of reading CD audio:
> http://www.xiph.org/paranoia/faq.html

> Regards,
> Florian Philipp






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-29 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-28  9:50 [gentoo-user] OT: What does the data stream to a sound card look like? Alan Mackenzie
2011-05-28 10:19 ` [gentoo-user] " Nikos Chantziaras
2011-05-28 14:13   ` Florian Philipp
2011-05-29 12:14     ` Alan Mackenzie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox