--- In gbadev@yahoogroups.com, Josh DeBonis <joshdebonis@y...> wrote:
> I'm trying to mix 2 sound samples on the GBA. When I
> play them individually, they sound great. When I mix
> them together, a sound is produced, but it's not
> pretty. I am simply adding the values of each sample
> together (it is a sample of the amplitude). I have
> tried scaling down the amplitudes before I add them,
> to prevent clipping, and this does not prevent the
> problem. Do I have to do any strange adding because of
> twos complement? Anyone know what I might be missing?
>
> Thanks,
> Joshua
For example, at
http://www.work.de/nocash/gbatek.htm#soundchannelaandbdmasound you
can find that GBA's Direct Sound channels can reproduce sound of
signed 8bit data. therefore, if your input digitized sounds are 8b
signed, you needn't adjust it in any way.
mixing of 2 channels means:
1) doing average out of each input samples (in case of 2 channels it
really is: (sampleA+sampleB)/2)
2) clipping the result value to range of signed 8 bits ie. -
128...127.
btw. isn't the problem anywhere else? are you sure that, 4xmpl the
DMA suffices to the mixing speed, etc?
good day