My music engine

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

Moderator: Moderators

Locked
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

My music engine

Post by tepples »

I made a game-oriented music engine for one project and reused it for Thwaite and two other games in the bundle, as well as its menu. NovaYoshi has been using it for his own project. I wrote NSF and NES wrappers, as seen in my NSF of these games. Memory consumption is on the order of 36 bytes zero page and 80 bytes BSS.

Right now, music is coded as .byt statements, with symbols for phrase bytecode and macros for song commands. Perhaps I should polish it up and write a compiler for a proper input language inspired by MML but not compatible with any MCK.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: My music engine

Post by zzo38 »

Do you support other mappers including some which have expansion audio?
(Free Hero Mesh - FOSS puzzle game engine)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: My music engine

Post by tepples »

Mappers provide three services: bank switching, IRQs, and expansion audio. I tried to make the music data format small enough that a typical NES game soundtrack could fit in a single 16 KiB bank. (Look at the size of the NSF that I linked above.) I can see where IRQs would be used for $4011 writes (as in blargg's sawtooth wave hack) but not much else, and that hack not only doesn't work in NSFs but also can cause audible artifacts when an ongoing OAM DMA blocks IRQ handler execution, as Dwedit pointed out.

I chose not to support expansion audio for three reasons:
  • I don't own a Famicom and a T-cart to test on.
  • Using expansion audio in homebrew involves either an expensive PowerPak, donor carts, or an old PC with a parallel port capable of running DOS and the FDS loader, making it difficult to distribute a game that uses expansion audio.
  • It'd increase the RAM footprint, which might not be so bad because most of these include built-in PRG RAM decoding.
But I do plan to distribute it as free software so that you can write your own patch adding VRC6, MMC5 or 5B support.

As I get various parts of the compiler done, I'll start to give lessons on the syntax for some features that I'm working on, such as building drums out of sound effects, playing phrases with transpositions, and adding swing to a phrase.
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: My music engine

Post by Shiru »

Considering that Famitracker now has standartized text export, I guess it could be possible to make a converter for this format?

As we have quite many sound/music engines now, I think it would be useful to have a Wiki page that lists them all, along with their capabilities, assembler formats, licenses, etc, so people could actually know about them and use in their projects.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: My music engine

Post by tepples »

I could make a basic converter for FT text export, but it would mostly be a tool for quickly entering phrases, as it wouldn't sound the same. The envelope paradigm differs, and the player doesn't use the MOD tempo/speed paradigm, and phrases can be started at any time, not just on pattern boundaries, and phrases can be transposed, and phrases can be shared among the three tone generator channels (as demonstrated in "Leck mich im Arsch" in the demo), and one channel can play attacks on top of another channel. There's a bit of impedance mismatch between FT's data model and mine.

ROM footprint of player: about 1.3 KiB
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: My music engine

Post by tepples »

Locked