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.

Beginners > a sound question

#34548 - tonedeaf - Fri Jan 21, 2005 5:56 am

I am attempting to write a simple gba program that uses the keypad to select and play music and sound effects. I am interested in using sound channels 1-4 to do this. I have looked at the belogic site and have managed to produce some very simplistic programs that start and stop a sound using BUTTON_A and BUTTON_B.
In searching the gbadev forum I came across these functions for using channels 1-2 posted by Vortex at the bottom of this thread .
http://forum.gbadev.org/viewtopic.php?t=2092

What is needed to make these functions play selectable music/sound effect patterns.
I have also download and unsuccessfully attempted to change the sg_tone_demo for this purpose . This code was somewhat more confusing to me, as I am new to both GBA and C.

thanks for any help

#34551 - tepples - Fri Jan 21, 2005 6:31 am

First off, you might want to go learn C in a more familiar environment.

Second, if you want to make music, you're going to have to write a sequencer that takes a list of notes in order and plays them. Step 1 is to learn about basic music theory and acoustics including "equal temperament" and/or "just intonation" (use Google) in order to convert note names (C#, Eb) to tone generator period values, and then use that to write play_note(). Step 2 is to write interpret_sequence() that calls play_note(), and then make your main program call interpret_sequence().
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.