Re: [linux-audio-dev] Re: Exact desicption of PCM system for ALSA

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Re: Exact desicption of PCM system for ALSA
From: Paul Davis (pbd_AT_op.net)
Date: Fri Jul 12 2002 - 16:17:27 EEST


>Yes I did have a look at this tutorial and it has been quite good,
>but I don't understand the signal which is produced there.
>I guess this seems to be a digital 101010... signal.
>But it sounds like an disordered signal and I don't
>understand how to unfluence the volume or the of frequency this signal.
>I actually have an algorythm for sine signals but it's too complex
>for undestanding.
>The problem isn't the interfacing via snd_pcm_open or snd_pcm_writei
>but I don't understand the data which is sent.
>I think the best for me would be an exact description of the PCM
>Signal description system which is also used in Windows Soundcard
>interface libraries ( or not? ). Perhaps someone knows good (E)books
>or tutorials about that.

its sound to me as though you need to a basic text on digital audio.

sound is a pressure wave. microphones convert the pressure wave into
continously varying voltages. an analog to digital converter reads the
voltage level many thousands of times per second, and converts the
voltage reading to a single digital value. with so-called "PCM"
encoding, the value (generally) varies between -(2^N) and (2^N)-1,
where N is the number of bits used to store the value. So a 16 bit
value will vary between -65536 and 65535. there are other ways of
encoding the value of the voltage, but the "PCM" method is by far the
most common.

all of the above happens on your audio interface. all ALSA does is to
allow you to read and write the values generated/used by the audio
interface. if you configured the audio interface for 16 bit samples,
then the data ALSA provides/collects from you is an array of 16 bit
entities ("short" in C terminology). if you configured it for 32 bit
samples, you have an array of 32 bit values. etc.

if the interface has more than one channel (as just about every one of
them does), then you also have to deal with the way that the data from
each channel is arranged. ALSA allows you to ask for interleaved
access, in which the samples from each channel are arranged one after
the other. if the card has two channels, therefore, the array contains
a sample for the left channel, then a sample for the right channel
taken at the same time, then the next sample for the left channel,
followed by the corresponding sample for the right channel etc.

but you can also ask ALSA for non-interleaved access, in which case
the data for each channel exists in completely separate arrays. most
hardware only supports one of these access methods, but ALSA can
"fake" either of them.

--p


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Jul 12 2002 - 16:21:02 EEST