Playing NSF music in FMOD.net

| | August 11, 2015

So, as the title says, I want to be able to play NSF files using FMOD, because my project already uses FMOD and I’d rather not replace it. This will involve figuring out how existing players and emulators work and porting it. I haven’t yet found an existing player that uses FMOD.

My starting point is the MyNes source from http://sourceforge.net/projects/mynes/. There are two big steps between here and what I’m looking for.

  1. MyNes plays from a ROM, not NSF. So, I have to rip out the APU and get it to play NSF files.
  2. The MyNes APU uses SlimDX, so I have to convert that to FMOD.NET.

I am really stuck about how to go about either of these, because I’m not that familiar with audio formats and it’s hard finding resources online. So here are a few questions:

  1. From what I can tell from the NSF spec at http://kevtris.org/nes/nsfspec.txt, it’s just contains the relevant memory section of the ROM, plus the header. If anyone can verify or correct this that would be great.
  2. The emulator APU uses data from the rest of the emulator to play, including things like cycle counts. I’m not sure what replaces this in a standalone player. Can’t I just load all the music data at once into a stream and play it?
  3. Joining #1 and #2, does the header data from the NSF substitute for some of the ROM data in the emulator code?
  4. Using FMOD, will I be following the usercreatedsound example for loading a stream? And does this format count as PCM? Specifically MyNes says PCM8. Any tips on loading / playing the stream in FMOD are appreciated.

As an aside, I don’t really understand the loading / playing sections of the spec I linked at all. It seems to apply to 6502 systems / emulators only and not to my situation.

I know it’s a long shot for anyone here to have enough experience in this area to help, but anything you can provide is definitely appreciated. A link to an existing .NET library that does this would be even better, but I don’t believe one exists.

2 Responses to “Playing NSF music in FMOD.net”

  1. FMOD supports file type plugins. I got here because I was looking for one of those, actually. Find one for NSF and you’ll be home free.

  2. Are you trying to play arbitrary files or are you making a game and your source music is in a NSF file? If it’s the latter (for example a lot of shipped emulated games do this) then it would probably be easiest to just save out the wave from your sound file using some other software (like winamp) and play that.

Leave a Reply