Your samples are clipping, that's what you're hearing.
What you have to do is to add the two of them and then create the average.
destSample = ( sample1 + sample2 ) / 2;
Guido
----- Original Message -----
From: Josh DeBonis
To: gbadev@yahoogroups.com
Sent: Monday, January 26, 2004 8:56 AM
Subject: [gbadev] Sound mixing
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
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
Yahoo! Groups Sponsor
ADVERTISEMENT
------------------------------------------------------------------------------
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/gbadev/
b.. To unsubscribe from this group, send an email to:
gbadev-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.