Starting to work on a sound engine

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Starting to work on a sound engine

Post by Tsutarja »

I'm going to start working on a sound engine so I need some help with it. Is it possible (and efficient) to make a sound engine that's songs are lists of patterns? The sound engine would read what pattern to play from the list. Once the pattern ends, it would return to the list and check the next pattern to play. Also, is it possible to make the sound engine read from FamiTracker's .nsf files?
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Starting to work on a sound engine

Post by tepples »

Yes, sound engines commonly represent music as lists of patterns in the way you describe. And yes, FamiTracker includes a "text export" command to convert FTM to a text format that your own translator can use.
User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Starting to work on a sound engine

Post by Tsutarja »

I just tried the text export, but the output doesn't really look like something that NESASM3 would understand if I added it to the program.
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Starting to work on a sound engine

Post by tokumaru »

You probably have to parse the output somehow to make it useful.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Starting to work on a sound engine

Post by tepples »

FamiTracker's text output is intended for you to write a PC program to translate the output into sequence data suitable for your own music engine. You might write this in C++, C, Java, JavaScript, Python, or whatever. Do you know any PC programming languages?
User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Starting to work on a sound engine

Post by Tsutarja »

tepples wrote:Do you know any PC programming languages?
Does Touhou Danmakufu and Game Maker count? Otherwise, no. I have some old version of FamiTracker that has .NSF export. Can't I use that?
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Starting to work on a sound engine

Post by tepples »

In theory you can use .incbin to include the body of FamiTracker's NSF export at the load address and play music through that.

In practice it's a lot harder for at least two reasons. One is that the NSF interface defines no way to play sound effects on top of the music. The other is that an NSF is allowed to use the machine's whole memory except for the top of the stack, which means you don't know in advance which memory your game is allowed to use.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Starting to work on a sound engine

Post by tokumaru »

Tsutarja wrote:I have some old version of FamiTracker that has .NSF export. Can't I use that?
If you include the whole NSF you'll be including more than the song data, since NSF files include the player code as well.

I imagine you could analyze the NSF and extract only the data from it, but if you use the exact same data format as FamiTracker you'll be essentially reimplementing the FamiTracker player, which is silly.

If you're implementing your own sound engine, you'll need to come up with your own data formats, and in order to handle custom file formats you absolutely need some programming experience.
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: Starting to work on a sound engine

Post by Kasumi »

Or look into something like Famitone or Famitone2.
User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Starting to work on a sound engine

Post by Tsutarja »

Kasumi wrote:Or look into something like Famitone or Famitone2.
I guess this would be the easiest way to get sound working. I'll try it when I have more time.
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi
Post Reply