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
Hello guys!
I have a couple of questions for you
Is it possible to make a fast vertical scrolling routine
using SDL?
I mean, in latest 10 years I coded on amiga…and all I have
to do is change a pointer to a bitmap
Now… I feel a bit discouraged on this vga cards…I can’t
do metalbashing code like I was used to
Any advice?
I tried also to implement a little sound engine.
To port on Linux this game I’m working on, I have to load
and play 8 bit sounds on a 16 bits device (ie sounblaster).
NOw…i just wrote a routine that loads an 8 bit iff 8svx sound
and convert every sample to 16 bits just multiplying it by 256.
That worked fine.
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?
please help me…
ciao,
Marco
Hello DaveOn 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