Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can someone explain unsigned vs. signed audio to me

3,585 views
Skip to first unread message

kdj...@....va.us

unread,
Aug 23, 2008, 7:25:46 PM8/23/08
to
I'm trying to figure out what the difference is between unsigned and
signed audio samples and how to do calculations with them. For
instance, in signed audio, what is silent? -max? 0? If zero, then what
is the difference between 1 and -1?

I know there must be some difference, because the .wav format
specifications explicitly state that 8-bit samples are unsigned while
16-bit samples are signed. So there must be some difference, but what?

Tom Plunket

unread,
Oct 19, 2008, 12:29:31 AM10/19/08
to
kdj wrote:

It's been a long time, but maybe I can still help.

The practical difference between signed and unsigned only really becomes
one of what value specifies the middle of the range. Waves go positive
and negative, so for unsigned values they go + and - where 0 is, well,
zero. If you're using signed values instead, then the data goes from 0
to 255 for 8-bit or 65535 for 16-bit. In both cases, the midpoint is
the "zero" point.

For audio data, though, the point is that it's a wave that makes a
speaker move. Silence isn't a particular value, silence is a zero slope
for a substantial period of time. So signed or unsigned, if all of your
samples are 0 or 354 or 20293, whatever, if they're all the same as
every other sample, then you won't hear anything. Another way to think
of it is that the minimum value of a sample is the speaker all of the
way pulled in, and the maximum value of a sample is the speaker pushed
all of the way out. Any time the speaker isn't moving, it's not making
noise.

Thinking about it further, the important thing regarding signed or
unsigned is what the range is. If you interpret signed data as
unsigned, or vice versa, your range is going to be disjointed. Consider
two-bit unsigned data:

00 = speaker all of the way pulled in
01 = speaker a little bit pulled in
10 = speaker a little bit pushed out
11 = speaker all of the way pushed out

If you were to interpret the data as signed, however, min-to-max the
values would go 10, 11, 00, 01, so loud values would be quiet and quiet
values would be loud. With more bits of resolution it'd likely end up
just sounding like noise.

-tom!

--

0 new messages