#109264 - musicman3320 - Thu Nov 16, 2006 4:39 pm
Hello all,
Recently, I have been learning how to use GBA Sound Channels 1-4 (from The Audio Advance, of course). In the process, I have come to realize that one of the formulas is incorrect. In particular, it is the formula for the length of Sound Channel 3. The formula given is:
RegisterValue = (length in seconds) * 256
But, in reality, the formula is:
256 - RegisterValue = (length in seconds) * 256.
One of the things that made this hard to find was that Uze's demo for Channel 3 (although very complete), did not really test the sound length attribute. Since he is playing a series of notes and continually resetting the sound, the length never really came into play. The only time it did was when the length was VERY high (like withing 20 of 0xFF), but by his formula, it should be the other way around. So, I created a small demo to test my theory, and, after running it on the actual GBA, I realized that, in fact, the formula was incorrect.
The main reason I am posting this is that there does not seem to be any documentation on this mistake it in the forums (or anywhere else for that matter), and I think it is important for people learning to use the legacy GB sound part of the GBA to know the correct formula. If I am incorrect, please let me know, and if anyone wants to see the demo I created to test it for themselves, let me know and I will be happy to post it.
-Chris
_________________
-- Did you hear about the programmer that died in the shower? The directions on his shampoo said "Wash, Rinse, Repeat." He died of a stack overflow error.
Recently, I have been learning how to use GBA Sound Channels 1-4 (from The Audio Advance, of course). In the process, I have come to realize that one of the formulas is incorrect. In particular, it is the formula for the length of Sound Channel 3. The formula given is:
RegisterValue = (length in seconds) * 256
But, in reality, the formula is:
256 - RegisterValue = (length in seconds) * 256.
One of the things that made this hard to find was that Uze's demo for Channel 3 (although very complete), did not really test the sound length attribute. Since he is playing a series of notes and continually resetting the sound, the length never really came into play. The only time it did was when the length was VERY high (like withing 20 of 0xFF), but by his formula, it should be the other way around. So, I created a small demo to test my theory, and, after running it on the actual GBA, I realized that, in fact, the formula was incorrect.
The main reason I am posting this is that there does not seem to be any documentation on this mistake it in the forums (or anywhere else for that matter), and I think it is important for people learning to use the legacy GB sound part of the GBA to know the correct formula. If I am incorrect, please let me know, and if anyone wants to see the demo I created to test it for themselves, let me know and I will be happy to post it.
-Chris
_________________
-- Did you hear about the programmer that died in the shower? The directions on his shampoo said "Wash, Rinse, Repeat." He died of a stack overflow error.