Re: [gentoo-user] Re: OT: What does the data stream to a sound card look like?
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
[gentoo-user] Re: OT: What does the data stream to a sound card look like?
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.
Re: [gentoo-user] Re: OT: What does the data stream to a sound card look like?
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 signature.asc Description: OpenPGP digital signature