#40531 - ghost Leinad - Tue Apr 19, 2005 11:33 pm
how can i add some sound to my project? (a not very difficult one please )
anybody can tell me a good conversion tool for sound?
i almost done with my tamagotchi lol... i just want to add some sound lol
thanks
#40532 - tepples - Wed Apr 20, 2005 12:07 am
Bleeps and bloops are easiest with the GB tone generators. Learn more here
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#40808 - Quirky - Fri Apr 22, 2005 8:58 pm
Bleeps and bloops are a fairly underused feature - everyone seems to use Direct Sound.
The tricky step is: How would one go about designing the correct input to the 'GBC' sound regs that output something similar to, say, a Mario jump sound?
Often recording sounds on your PC in .wav form, converting with Sox, then shoving those through the direct sound fifos gives faster (time-to-design-and-code) results. But bigger rom size, of course.
#40814 - Kyoufu Kawa - Fri Apr 22, 2005 9:39 pm
Hey, Captain Quirk, even though I'd personally rather not try it at all, one could always run Super Mario Land through a debugger and find the exact sound register values, right?
#40816 - Quirky - Fri Apr 22, 2005 10:13 pm
Well, yes :-) but I meant "a sound like it" - i.e. built from scratch. The GBA might well use DS in Mario Advance anyway? Course in the older Mario Worlds you'd get the proper values, though I don't know if the equivalent register bits have exactly the same meaning on the older GB models, requiring a bit of parsing, not too much hassle. (I've done similar stuff to "capture" GBC-like sound effects from other systems and reuse them)
#40832 - tepples - Sat Apr 23, 2005 2:50 am
Quirky wrote: |
Well, yes :-) but I meant "a sound like it" - i.e. built from scratch. |
Try the BeLogic sound 1 test ROM and play around. Hint: sweep shifts 7, sweep direction add, sweep time 7, sound length 0, wave duty cycle 1, env step time 4, env step dir down, env init vol 0x000F, freq 0x0630, loop mode loop.
Quote: |
The GBA might well use DS in Mario Advance anyway? |
"DS" is ambiguous. It could stand for the Dual Screen Developer System, or it could stand for DirectSound (Windows PCM playback API), or it could stand for Direct Sound (GBA PCM playback hardware). I prefer to call the GBA PCM "PCM". But yes, Super Mario Advance does use PCM.
Quote: |
I don't know if the equivalent register bits have exactly the same meaning on the older GB models |
The sound models are so similar that you wouldn't notice much of a difference.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#42102 - ghost Leinad - Thu May 05, 2005 11:20 pm
well now you lost me :( ...im just thinking in how to add a simple bleep at my tamagotchy and now i have to learn 32 pages of sound registers and stuff jajaja...well is not that bad... i hope i can learn before the next tuesday...
tanx for your help..im starting to study now
****
studiyng
****
#42135 - Quirky - Fri May 06, 2005 3:08 pm
If you just want a beep, then this should work:
Code: |
#define SOUND_LENGTH(n) n
#define ENVELOPE_START_VALUE(n) (n<<12)
#define DUTY_CYCLE(n) (n<<6)
void init_sound() {
REG_SGCNT1 = 0x80; // sound master on
REG_SGCNT0_H = 2;
REG_SGCNT0_L = 0xff77; // full sound
REG_SG10_L = 0x8; //;square0 sweep off
REG_SG10_H = SOUND_LENGTH(0x1f) | DUTY_CYCLE(3) |
ENVELOPE_START_VALUE(ENVELOPE_VOL_S1);
}
void play_annoying_beep(int forever) {
if (forever)
REG_SG11 = 0x8778; // sound on for ever
else
REG_SG11 = 0xC778; // sound stops after a short while
}
|
There are lots of magic numbers there, but it might get you started.
The 11 lowest bits in SG11 are the sound frequency, which you can calculate as:
Real F(hz)=4194304/(32*(2048- 11 bit reg value))
And the top 2 bits contol sound reset and whether it should stop after SOUND_LENGTH(n) or not (if not, you need some way to stop it using interrupts).
#42151 - ghost Leinad - Fri May 06, 2005 9:22 pm
mmm...i will try that today...thank you very much
ok...now my next question...about the background music...is harder to put some background music in your game than just a simple beep???
a game could be very boring without music!!! lol
thanks
#42153 - tepples - Fri May 06, 2005 9:31 pm
Background music is just a script of beeps played at various pitches at various times. Writing the player is easy enough, but writing the script (called a "musical work") is a legal minefield.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#42155 - ghost Leinad - Fri May 06, 2005 9:50 pm
mmm...very big deal right???
well...creating a new song from ground up will be a real big problem...but can i use some examples meantime???
and by this time i have to study sound registers, sound channels, fixed-point arithmetic, music copyrights :S
thank teppes...(is because of alucard or dracula???)
#42157 - ghost Leinad - Fri May 06, 2005 9:58 pm
upppsss it's tepples no teppes
#42411 - ghost Leinad - Wed May 11, 2005 1:10 am
ok thank you very much to all
i found that learning the basics of sound was not that hard...
sound channel one was very easy, and sound channel 3 seems very fun.
what's the difference between a demo and a game???