gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > AAS and high notes crapping out, in sound and CPU usage

#46061 - DiscoStew - Sun Jun 19, 2005 5:49 am

For the past few days, I've taken a break from programming to work on converting SPCs into MODs to use with AAS, and I'm glad to say that the conversion sounds really good (even if they are beign played as MONO most of the time). However, I've run into some audio problems when running them using AAS on the GBA.

1) With AAS, is there a certain limit beyond the normal limit that notes can be played at? I'm wondering because after having converted SPCs to MOD, I've had to take into consideration of the samples being at a constant ~8kHz, and change the transpose of all the notes to make them match the original sounds of the song. The problem with that is the notes can tend to be REALLY high, and with AAS, the audio begins crapping out right at those points, and even sounds like the notes can't be played as high as they are set to be. I can fix this problem internally by resampling the problematic instruments, and changing the transpose again for each note using that instrument, but that will require both time and effort as I am using the same samples over a bunch of songs.

2) With AAS, does it require more CPU time when playing high notes? This is from a result I've seen after having dealt with the 1st problem above, with visual effects and updating of data to use on it.
_________________
DS - It's all about DiscoStew

#46063 - tepples - Sun Jun 19, 2005 6:05 am

The MOD has a maximum pitch for each sample, which some players enforce more strictly than others. Downsample the problematic instruments by a factor of 2 (e.g. from 16744 Hz to 8372 Hz) and things should be fine.

AAS is known to runs faster with low pitches. It appears to use a technique described in this thread about mixer optimization, using the ARM conditional execution bits to take the time to load and amplify a new sample only if the source address has increased. Obviously, the source address will increase more often for a sample being played back at a faster rate.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#46159 - jd - Tue Jun 21, 2005 12:16 am

DiscoStew wrote:

1) With AAS, is there a certain limit beyond the normal limit that notes can be played at?


Yes - four times the mixing frequency. (So a quick way to test if this is the problem would be to increase the mixing frequency.)

DiscoStew wrote:

2) With AAS, does it require more CPU time when playing high notes?


Yes, although generally the difference should only be relatively small. (Also, remember if you play samples above the mixing frequency then the extra sample data is unused.)