Average size for music engine

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

Moderator: Moderators

Post Reply
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Average size for music engine

Post by Banshaku »

I would like to know what is the average size in general for the music engine that have been seen either for commercial games or that people developed by themselves? And in the size, not just the code but any LUT and pre-generated data that they may have required to make it work.

Simple question but maybe difficult to answer. I'm sure Neil can give his comment about is current Ninju and people that did their own sound engine like Bregalad, Celius, Tepples too. I have no knowledge about NSF ripping but maybe rippers knows about the size of the commercial ones.

Any information on the subject will be appreciated.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

With or without the music sequences and instrument definitions?

(My last post on the topic)
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

The driver code (SFX internal code too) and it's internal LUT only without the music data and instruments data specific for that song. It seems that your driver is only 768 bytes, which is quite small and it's a good thing.

The latest FT driver is easily 4.2k because of the all the new effects. I'm trimming it to remove what I don't need for my mm9 project. I'm down to 3.6k and still trimming.

I just want to know if it's was common for commercial games to have big driver or not. I guess it all depends on the features of the driver.
User avatar
MetalSlime
Posts: 186
Joined: Tue Aug 19, 2008 11:01 pm
Location: Japan

Post by MetalSlime »

The Guardian Legend's sound engine is 2,439 bytes:

Code takes up 1782 bytes.

LUTs take up 657 bytes. These tables include all the volume envelopes and pitch envelopes, since The Guardian Legend doesn't use an instrument system. If you don't want to count these, LUTs only take up 295 bytes (for a sound engine total of 2077).

That's the only sound engine I know about in great detail, so I can't comment on averages.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

Wasn't 16kB a fairly common memory budget given to musicians for all the code + data needed for the soundtrack? I recall seeing that figure a few times.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Banshaku wrote:I just want to know if it's was common for commercial games to have big driver or not. I guess it all depends on the features of the driver.
A sound driver in a more complex (i.e. bigger) game will tend to have more features because they fit. Compare the music of Binary Land to that of Kirby's Adventure or Silver Surfer.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

The driver I use im my current game is fairly small, about 650 bytes total (including all code to run sound, start and stop music&SFX, lockup tables, but no music/SFX data itself).
As my game is 32kb so I don't want to waste a lot of music. It's possible to come with a very small driver, that only fetches data and write stuff to registers, and then come with a customizable effect system, so that you waste as much size as you want for the extra effect (like vibratoes, software pitch slides, arpeggio, etc...)
Useless, lumbering half-wits don't scare us.
ugetab
Posts: 335
Joined: Sat Oct 29, 2005 12:03 am
Contact:

Post by ugetab »

Use the SVN build of FCEUX, and use the Code/Data Logger on all the songs in an NSF. You can use this to get an accurate readout of your desired data this way(Bytes Logged As Code), though, this only accounts for code actually used, not likely the error-recovery code, or branches not used due to no sound effect usage.

I suggest FCEUX because it works with the speedup button. If you're willing to wait, then you can use my copy of FCEUXDSP, which is pre-built and on my page.
NSFs I've ripped:
http://www.angelfire.com/nc/ugetab/

A Searchable list of NSFs from other sites. In Internet Explorer, go to Edit>Find (on This Page)...
http://www.angelfire.com/nc/ugetab/NSFList.txt
User avatar
Memblers
Site Admin
Posts: 3901
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

Nerdtracker 2 is about 3kB.. not sure of the exact size, but that's what I budget for it. Probably a little under 600 bytes of it are LUTs.
User avatar
neilbaldwin
Posts: 481
Joined: Tue Apr 28, 2009 4:12 am
Contact:

Post by neilbaldwin »

All code & tables (but no music data) in Nijuu is currently about the 6.5k mark. But don't use Nijuu as a benchmark, it's not written to be ROM-space friendly really :)
Drag
Posts: 1350
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Post by Drag »

The music engine I designed, which has a decent amount of features (volume envelopes, pitch bends, looping, detune, sound effects, etc) is 1476 bytes. This is just the code, the lookup tables, and blank placeholders for the data (so it'll compile :P).

My music data is a little bulky though, each note being two bytes (pitch, duration). That and I still would need to add a few commands to allow less redundancy in the music data. On the plus side, it's easy to code the music in hex! :P
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

If NT2 is already around 3k, this seems to be the norm for a driver used with a tracker then. The more flexibility you add, the more it will grow. For now I will stop worrying about size unless it's really an issue.

The 16k limit mentioned before.. That's quite small so if you want to add a lot of music... If you have to be quite creative on the coding/data format side.
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

My music engine is currently just over two kilobytes, which I suppose isn't that great since my game is 32k. Though it does seem to perform pretty fast and be fairly flexible. Music data should be very small, though sometimes it's hard to determine sizes for certain sounds since some are defined with code rather than just bytes (they are still considered data even though they are made of 6502 instructions though). It is kind of impossible for me to determine now the exact sizes of music, as I am still in the engine making stage of game design; I'm saving data creation for the end.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

The 16k limit mentioned before.. That's quite small so if you want to add a lot of music... If you have to be quite creative on the coding/data format side.
Either that or you just make a few songs that you repeat throughout the game.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

As for driver sizes (code + LUTs, not including music data), most of the ones I've written (SN76489, YM2413, YM2151, YM2612, AY-3-8910, Konami SCC, SID) are between 1.5 and 3.5 kB in size. That's just ROM, though - some of them can use over 1 kB of RAM depending on how many channels you're using.
Post Reply