[SDL] linux 2.2.11 problem

Karl Bartel karlb at gmx.net
Thu Aug 26 04:41:14 PDT 1999


Hello Dave

On 05-Ago-99, you wrote:

>> But, I wanted to half all samples volume, by multiplying every
>> byte for 128 instead 256..but , in this way, I obtained not
>> an half volume sample..but a  noisy and lousy sample..only similar
>> to original...
>> The question is..WHY? :)
> 
> Samples are either signed or unsigned. Your problem is symptomatic of
> getting the sign of the samples different from the sign of the audio
> device. So during a waveform that is smooth, you're actually wrapping
> around to the opposite end of the range of values (causing a
> discontinuity).
> 
> Probably you could fix your problem by doing the multiply by 256, then
> shifting it right by 1 bit but duplicate the sign bit.
> 
> Best thing is to set the audio device to expect signed samples, make sure
> your 8 bit samples are signed, and converting to 16 bits by multiplying by
> 128 or 256 should work fine. Summing signed samples is easier also, you
> only have to clip once and you can sum a variable number of samples
> without -Dave

So i did :(
I load an iff 8svx sample (8 bit signed) and convert it in a 16 bit signed
sample (S16LSB).
So..cant be this the solution :(

ciao,
Marco




More information about the SDL mailing list