Hi all,
I'm complete novice with GB programming, I'm only trying to work with sound and keypads. Anyway, I haven't seen any other examples in GBDK package than sound.c, don't understand it, could someone send here a simpler example like:
just one sound, any frequency, duty cycle 25% on first channel, duration 1 second
and perhaps instructions what is needed to use two other channels and noise channel.
I would be eternally grateful, thanks for advance !
-jp
GBDK sound example
Something like this:
Refer to pandocs for more info.
Code: Select all
unsigned short freq = 1750; // approx 440 Hz
NR50 = 0xFF;
NR51 = 0xFF;
NR52 = 0x80;
NR10 = 0; // No frequency sweep
NR11 = 0x40; // 25% duty cycle
NR12 = 0xF0; // Maximum volume
NR13 = (unsigned char)freq;
NR14 = 0x80 | (freq>>8); // Start output
// Wait for as long as you want to output sound..
// Mute channel 1 (there are other ways to do this)
NR12 = 0;
NR14 = 0x80;
Thanks very much, now I will check documents for addresses to other channels, yes, I'm eternally grateful, thanks mic_ !!!
-Jukka
-Jukka
mic_ wrote:Something like this:
Refer to pandocs for more info.Code: Select all
unsigned short freq = 1750; // approx 440 Hz NR50 = 0xFF; NR51 = 0xFF; NR52 = 0x80; NR10 = 0; // No frequency sweep NR11 = 0x40; // 25% duty cycle NR12 = 0xF0; // Maximum volume NR13 = (unsigned char)freq; NR14 = 0x80 | (freq>>8); // Start output // Wait for as long as you want to output sound.. // Mute channel 1 (there are other ways to do this) NR12 = 0; NR14 = 0x80;