1

I'm making a game with some friends for our last highschool project . I'm having trouble finding out how to play the music I've written in c# and I'm turning here for answers.

We're using Microsoft Visual studio 2010, and I've mainly been writing music for the game during this time so I'm quite a beginner at programming in C#.

The Music I've made is made in a program called Famitracker don't know if your familiar with it but I can export the files to NSF which is good since they take up low disk space.

So my real question is how do I make our game play the music and loop it until the play gets to the next stage?

mjv
  • 73,152
  • 14
  • 113
  • 156
user699335
  • 11
  • 2

3 Answers3

1

NSF, or the Nintendo Sound Format is not something that Windows nor .NET supports natively... instead you would have to either write or find your own player for it... or redo your music in something more common like MP3 or WAV.

If you want to stick with NSF, I'd suggest looking at one of the open source NES emulators out there and see if you can't use of of their code. (Example 1) (Example 2) (Example 3)

Brendan Grant
  • 937
  • 7
  • 16
  • I took a brief look at the code for all of those emulators and it doesn't look like high school students will be able to extract anything. They either haven't fully implemented it, or else the sound is way too integrated with the low level workings of the emulator. My vote goes to the .wav solution. – captncraig Apr 08 '11 at 21:17
1

Your easiest solution would probably be to output is as a wav and play it using XNA as Matthew describes. The file size may be larger, but unless you are having file size issues, I think that will by far be the easiest way to go. There doesn't seem to be any easy implementation of a nsf player in C#, although you might look into how NES emulators are doing it.

captncraig
  • 22,118
  • 17
  • 108
  • 151
-1

Use the XNA framework for audio, etc in games. Here is a good starting point: http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=xna+framework+play+audio

Matthew
  • 2,210
  • 1
  • 19
  • 30