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

2002-07-12 Thread Paul Davis

>> 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
>
>Errr, I think you meant  "... between -(2^(N-1)) and 2^(N-1)-1 ... "
>So you get a range between -32768 and 32767 for 16 bit signed
>or between 0 and 65536 for unsigned 16bit.

yes, indeed i did. sorry for the error. this reply is just to confirm
that alex is right, and i am wrong :)



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

2002-07-12 Thread Alexander Ehlert

Hi Paul,

> 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

Errr, I think you meant  "... between -(2^(N-1)) and 2^(N-1)-1 ... "
So you get a range between -32768 and 32767 for 16 bit signed
or between 0 and 65536 for unsigned 16bit.

Cheers, Alex




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

2002-07-12 Thread Paul Davis

>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




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

2002-07-12 Thread Alexander Ehlert

Hi Philipp,

> 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.

It seems like you're missing the basic understanding how digitial audio 
works
at all. For example take your CD player at home. The music has to be 
recorded
digitally in a studio in the first step. The analog signal of the music 
is quantized
in a certain resolution. That can be an arbitrary number of bits, 
usually 8, 16, 24
bits. For a CD that's 16bits. Thus the former analog signal is now 
represented
by 2^16 different voltages or given as a signed integer you have a 
possible
range between -32768 and 32767 for your audio signal or in other
words, that are the maximum values for the amplitude of your sound 
signal.
Ok, now I could go on about the sampling frequency and other stuff.
But I'm too lazy :*)

> Signal description system which is also used in Windows Soundcard
> interface libraries ( or not? ). Perhaps someone knows good (E)books
> or tutorials about that.

Have a look into the source of small audio applications. And for basic 
information
search the internet. A good resource for dsp/audio programming is
http://www.harmony-central.com

Cheers, Alex




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

2002-07-12 Thread Philipp Vollmer

Hello dear Dr. Nagorni,

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.

73 de DO1YPV ( Philipp Vollmer )