Sound Output
Moderator: Moderators
Sound Output
Is anyone familiar with a simple way of doing sound output on the NES? What I'd like is a way to implement music or sound effects. All the docs I've found on the 'net are in japanese, so I'm kind of in the dark here.
If you don't want to write your own music code, you can use NT2 (http://nesdev.com/nt2/). To get sound effects you can modify the player code to write to RAM instead of the sound registers, that way you can pre-empt the channels with your own sound effect code.
Most of the Japanese docs are probably about MCK, it's another simple way to make music. But the player code uses a lot of memory when I checked last, it might be tougher to use it inside another program.
Most of the Japanese docs are probably about MCK, it's another simple way to make music. But the player code uses a lot of memory when I checked last, it might be tougher to use it inside another program.
You have to make your own data format (or use an existing one, but there isn't one specifically for sound effects), then have a player program that decodes it and outputs it to the NES sound registers. The player code would be ran every frame (60 times a second). Normally there's a second subroutine to be called for initializing a particular song/effect before playing.
Here's a reference on the registers.
http://nesdev.com/wiki/?page=NES+APU
This is pretty much how the NSF format works too. If you have memory free in the areas the NSF code uses, you can include it in a program and JSR to the play and init routines, and it works. I did that a lot myself with NT2 before I changed the player code to work with the assembler I normally use.
Here's a reference on the registers.
http://nesdev.com/wiki/?page=NES+APU
This is pretty much how the NSF format works too. If you have memory free in the areas the NSF code uses, you can include it in a program and JSR to the play and init routines, and it works. I did that a lot myself with NT2 before I changed the player code to work with the assembler I normally use.