[Openal] Can someone explain signed vs. unsigned audio

Ed Phillips ed at UDel.Edu
Tue Sep 2 08:40:23 PDT 2008


Hi,

On Sat, 30 Aug 2008, Kyle D. Jansen wrote:

>>
>> For signed 8 bit:
>> Silence would be 0. Full positive would be 127. Full negative would be -128.
>>
>> For unsigned 8 bit:
>> Silence would be 127. Full positive would be 255. Full negative would be 0.
>>
>> Similarly with 16 bit signed: 0 is silence, 32767 is full +ve, -32768 is full -ve.
>> 16 bit unsigned: 32767 silence, 65535 full +ve, 0 full -ve
>>
>> --
>> Best regards,
>> Peter                            mailto:darkmatter at blueyonder.co.uk
>
> Then what is the difference between signs, since, as far as the bits, 
> [signed] -128 == [unsigned] 0? Further, how is volume heard? ie, is -127 
> as "loud" as 127? I'm doing calculations with the psychological volume, 
> and I want to be clear on this.

The sample values are the amplitude of the sound waveform at a given 
instant.  There are 256 possible amplitude values for 8-bit samples, and 
65,536 possible amplitude values for 16-bit samples.  A hardware A-to-D 
converter would produce digital samples based on the numeric "standard" 
that the implementors decided to use (i.e. signed vs. unsigned, 8-bit vs. 
16-bit, etc.).  The exact same waveform can be represented digitally with 
the same degree of accuracy whether you're using signed or unsigned 
integers... but once you digitize it, math operations may need to be 
handled differently depending on what you choose.  Some implementors may 
choose signed integers because it's more straight-forward to add two 
signed numbers in hardware on a computer and get the correct signed result 
without extra math operations, and to gracefully handle 
wrap-around/overflow situations (numerically at least - sonically, you 
don't want to introduce a positive-127-to-negative-128 amplitude 
transition in your waveform between two successive samples.... POP!).

Signed numbers are conceptuallly more like the real waveforms (i.e. 
centered at zero, positive and negative amplitude values) so can be a bit 
easier to grasp (despite with the mental hurdle of "two's compliment" 
representation of the numbers if you start looking too closely or need to 
encode samples by hand).

Hope this helps...

 	Ed

Ed Phillips <ed at udel.edu> University of Delaware (302) 831-6082
Systems Programmer IV, Network and Systems Services


More information about the Openal mailing list