Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: OT: What does the data stream to a sound card look like?
Date: Sat, 28 May 2011 14:15:04
Message-Id: 4DE102FE.6060708@binarywings.net
In Reply to: [gentoo-user] Re: OT: What does the data stream to a sound card look like? by Nikos Chantziaras
1 Am 28.05.2011 12:19, schrieb Nikos Chantziaras:
2 > On 05/28/2011 12:50 PM, Alan Mackenzie wrote:
3 >> Hi, Gentoo.
4 >>
5 >> It occurred to me the other day that I am clueless about how a sound
6 >> card works. How do the data get into it? Does the sound card use an
7 >> interrupt to ask for more data?
8 >
9 > The data is placed in RAM. The card reads it from there using a DMA
10 > operation. You can read about it here:
11 >
12 > http://en.wikipedia.org/wiki/Direct_memory_access
13 >
14 >
15 >> What form do the data take?
16 >
17 > It's raw data, and its form depends on what the card is expecting. What
18 > the card is expecting is programmable by the card's driver.
19 >
20
21 Most likely it is some PCM format (pulse code modulation) not very
22 different from WAV, CDDA, etc. (just without headers, of course). In the
23 easiest case, the sound card then just feeds this into a digital-analog
24 converter connected to the output (together with a analog-digital
25 converter this is called an audio codec, for example AC'97).
26
27 AC3 or DTS, the compressed formats found on DVD, can also be "passed
28 through" the sound card to reach a home theater system over a digital
29 output without being converted into an analog signal.
30
31 >
32 >> Say I feed an mp3 through the card. Does
33 >> the Athlon do the decompression, or does the sound card do it?
34 >
35 > The MP3 is decoded by your CPU (by software like libmad, xine,
36 > gstreamer, etc.) The decoded data is send to the driver, the driver
37 > applies any needed conversions to it (according to what the card
38 > expects), and then places it in RAM so the card can get it by means of DMA.
39 >
40
41 This can be observed in some cases when the system crashes during
42 playback. Then sometimes the card just seems to loop over the last data
43 packet placed in RAM.
44
45 >
46 >> Last of all, is there a command line program which can play a CD by
47 >> feeding its data into the sound card?
48 >
49 > Today this works the same playing any other audio. The fact that audio
50 > in this case comes from a CD doesn't matter. An application reads the
51 > audio from the CD, sends it to the driver, and from there it gets to the
52 > sound card.
53 >
54
55 The cdparanoia FAQ provides a lot of insight into the special problems
56 of reading CD audio:
57 http://www.xiph.org/paranoia/faq.html
58
59 Regards,
60 Florian Philipp

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies