2
\$\begingroup\$

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.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ no, I explicitly want to play nsf files. I am making a game, and right now it does use wav files. The issue with that is that 1. wav files are much much larger in file size, so distribution is a pain, and 2. looping properly requires the wav files to be edited just right so it sounds clean. An NSF has neither of these problems, and also doesn't require conversion (the musicians in the project write NSF). \$\endgroup\$
    – Tesserex
    Commented Dec 30, 2010 at 18:14
  • \$\begingroup\$ also note about file size: I can't use smaller formats like mp3 because they have buffers that prevent smooth looping from ever working properly. \$\endgroup\$
    – Tesserex
    Commented Dec 30, 2010 at 18:15
  • 2
    \$\begingroup\$ If file size is a concern and you're authoring new song content and you're using FMOD, have you considered using a mod tracking format like XM or IT? FMOD supports those natively. \$\endgroup\$
    – Tetrad
    Commented Dec 30, 2010 at 18:21
  • \$\begingroup\$ ^ +1 for XM/IT. Or if you wanna go crazy, implement your own NSF player with System::createDSPByType() for your tone generators. ^_^ \$\endgroup\$ Commented Jan 22, 2011 at 17:43
-1
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .