Playing NSF music in FMOD.net

Posted by Tesserex on Game Development See other posts from Game Development or by Tesserex
Published on 2010-12-30T15:34:40Z Indexed on 2010/12/30 16:01 UTC
Read the original article Hit count: 463

Filed under:
|
|

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.

© Game Development or respective owner

Related posts about c#

Related posts about audio