Re: 16-Bit Stereo PCM Standard?

Alberto Luaces <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
"Patrick M. Rutkowski" writes:

> Hi there guys,
>
> I'm very very (and very again) new to audio programming. I only just
> yesterday learned the basic of PCM data formats, and there are still a
> lot of unanswered questions.
>
> Firstly, I'm playing with OpenAL by having libmad read mp3 data out of
> my song files. The sample code shipped with libmad passes signed
> 16-bit PCM data back to the developer, so I went with
> AL_FORMAT_STEREO16 when feeding the libmad output into alBufferData().
> Somehow it just worked, and the song plays fine.
>
> But what I'm confused about is how OpenAL transforms the stream of
> 16-bit PCM samples into the decibels which come out of the speakers. I
> mean, say for example that one of the PCM samples has the value 1843,
> and that the stream's frequency is 700 samples per second. Surly it
> can't be that the speakers output 1843db for that 1/700th of a second,
> because that would be insane! :-)
>
> But then what exactly is it that they do output? How is the PCM sample
> "1843" converted into a decibel value for output? Is there some
> standard that defines how all this happens? Or is it just an accident
> that the data output by libmad can be conveniently input into
> alBufferData()?

Hi Patrick,

this is more a hardware question than a software question, I
think. OpenAL and the other sound APIs send the processed data to the OS
sound layer and after that, the magic happens. Think of it as the
commands you could send to a GPU in order to draw a scene in your
monitor. You send the data required and how to do it, but the hardware
is the one that does the fine work in last instance. Of course, OpenAL
did first also the big job of mixing the sources, doing their positional
attenuation, etc.

When you use a 16-bit PCM format, you are saying that your sound data is
digitalised with a resolution of 16 bits. A value of 1843 doesn't mean
1843dB, but that the signal is "that" strong in the 0 - 2^16 range. You
could have 8 bit data, signed or unsigned or float components as well.

Maybe those links are useful to you in order to know how the hardware
transforms the final digital sound data into pulses for the speaker:

http://en.wikipedia.org/wiki/Sound_card
http://computer.howstuffworks.com/sound-card.htm

--
Alberto
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.