public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Re: OT: What does the data stream to a sound card look like?
Date: Sun, 29 May 2011 12:14:59 +0000	[thread overview]
Message-ID: <20110529121459.GA4139@acm.acm> (raw)
In-Reply-To: <4DE102FE.6060708@binarywings.net>

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






      reply	other threads:[~2011-05-29 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110529121459.GA4139@acm.acm \
    --to=acm@muc.de \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox