[SciPy-User] Wave files / PCM question

Dan Goodman dg.gmane@thesamovar....
Mon Nov 8 07:41:14 CST 2010

Thanks Nic and David,

Right, so it seems the consensus is that you shouldn't use the 0 or 
-2**15 value. This means that in fact it's the unsigned byte that is 
wrong in some sense, and should probably have been a signed byte (I 
guess they chose not to do that because it's an unusual type). I can see 
the validity of wanting to have 0 explicitly represented (for silence).

Incidentally, I don't mind which way it's represented, the inefficiency 
of not using one of the values doesn't bother me, it just struck me as 
the sort of thing that would have bothered the people designing these 
systems in the first place! :) All I mind about is knowing for sure that 
this is the representation the computer really uses. Your arguments 
almost 100% convince me, but just to satisfy myself, does anyone have a 
definitive reference that when you pass a stream of 8/16 bit samples to 
the sound card (via the OS), that it is interpreted in this way? 
Incidentally - what happens if you do use 0 or -2**15? Will it 
correspond to something slightly less than -1?

David - I'll see if I can find that reference. We might have a copy of 
it in my lab as it's an auditory psychophysics lab. You'd think someone 
there would know the answer to my question, but they all just pass an 
array of floats to Matlab and let it work out the details!


More information about the SciPy-User mailing list