gravelstudios wrote:
If you don't want to use a tool like famitracker:
Just doing simple sound effects is pretty easy. when the event occurs in your game that you want to make the sound, just write the correct values to the registers for the channel that you want it to play on (pulse1 is $4000 - $4003, etc.). A little experimentation will give you an idea of what the different registers do.
Music is rather harder. I think the simplest way to play music is to have a table of all the data you want to load into the audio registers for a channel, and an index variable that points to the current byte you want to load. use the length counter for the channel, and read $4015 on every frame to determine when each note has ended. When it has ended, increment your index and load the next four bytes for that channel. This is not a very flexible sound engine, but it's probably the easiest to conceptualize.
Music and sound effects at the same time gets even more complicated. You could just set aside one channel (probably pulse2) for only sound effects and the other 3 for just music. Some games do this. Making a channel switch back and forth between music and sound effects is more challenging. You'd have to set up boolean variables to indicate whether each channel is supposed to be playing music or sound effects on any given frame, and a system to keep each channel's music index in the correct place in the music table while sound effects are playing, or that channel will get out of sync with the others. This is when you're starting to enter territory of building a real audio engine though.
I'm reading this:
http://nintendoage.com/forum/messagevie ... adid=23452 , it's very complete as tutorial, but I still need to have a music "Traslated" in HEX for NES
.