From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-user+bounces-123335-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QQewB-0002xO-FP
	for garchives@archives.gentoo.org; Sun, 29 May 2011 12:17:43 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4E4CE1C00A;
	Sun, 29 May 2011 12:16:00 +0000 (UTC)
Received: from mail.muc.de (colin.muc.de [193.149.48.1])
	by pigeon.gentoo.org (Postfix) with ESMTP id C89CE1C00A
	for <gentoo-user@lists.gentoo.org>; Sun, 29 May 2011 12:15:59 +0000 (UTC)
Received: (qmail 49760 invoked by uid 3782); 29 May 2011 12:15:58 -0000
Received: from acm.muc.de (pD951A305.dip.t-dialin.net [217.81.163.5]) by
	colin2.muc.de (tmda-ofmipd) with ESMTP;
	Sun, 29 May 2011 14:15:57 +0200
Received: (qmail 4147 invoked by uid 1000); 29 May 2011 12:14:59 -0000
Date: Sun, 29 May 2011 12:14:59 +0000
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Re: OT: What does the data stream to a sound card
	look like?
Message-ID: <20110529121459.GA4139@acm.acm>
References: <20110528095044.GA3946@acm.acm> <irqi83$3vd$1@dough.gmane.org>
	<4DE102FE.6060708@binarywings.net>
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4DE102FE.6060708@binarywings.net>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@muc.de>
X-Primary-Address: acm@muc.de
X-Archives-Salt: 
X-Archives-Hash: 8689ca2f89f56f6b7bfdc467bbd59f85

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