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