How many tracks can a NES cartridge have?

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

Moderator: Moderators

Canamp1720
Posts: 2
Joined: Sun Apr 18, 2021 10:06 am

How many tracks can a NES cartridge have?

Post by Canamp1720 »

I was searching for an answer to this question, but apparently I'm the first person to ask about this (or maybe I haven't searched well enough).

There's obviously a limit as to how many songs a NES game is allowed to store and play (considering the limitations of the era), but what's the limit?

And therefore, what NES game had the most tracks?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: How many tracks can a NES cartridge have?

Post by lidnariq »

"How long is a piece of string?"

Different engines can be more or less space-efficient. Songs usually consume length proportionate to their complexity, not their duration. How different does something have to be to be a different track? (If the game plays the same thing but with certain voices muted, is that the same or not? How about multiple different lead-ins?)

The NSF format imposes a limit of 256 tracks.
User avatar
nesrocks
Posts: 563
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: How many tracks can a NES cartridge have?

Post by nesrocks »

Also, a million "songs" if you use something procedurally generated.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
Canamp1720
Posts: 2
Joined: Sun Apr 18, 2021 10:06 am

Re: How many tracks can a NES cartridge have?

Post by Canamp1720 »

lidnariq wrote: Sun Apr 18, 2021 5:10 pm "How long is a piece of string?"

Different engines can be more or less space-efficient. Songs usually consume length proportionate to their complexity, not their duration. How different does something have to be to be a different track? (If the game plays the same thing but with certain voices muted, is that the same or not? How about multiple different lead-ins?)

The NSF format imposes a limit of 256 tracks.
Well, regarding your question as to how different a track has to be, I was thinking each track to be their own thing, like any popular NES game.
For example, Super Mario Bros. had tracks for the Overworld, Underground, Castle, Underwater and the Starman item; although I'm kinda curious here, are the fast-paced "hurry up" variants of the tracks considered separate or are they just straight up sped up?
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: How many tracks can a NES cartridge have?

Post by dougeff »

After you jump on the flagpole in SMB, it plays a 7 second song. That might be 200 bytes. Another song could be 5 minutes long and use all 5 channels. That could be 5000 bytes.

Let's split the difference. 2500 bytes per song. And let's say the entire ROM is dedicated to playing music, and you are using a 256 kB PRG-ROM (minus 6kB for the music code) = 250 kB.

250 / 2.5 = 100 songs, if the songs are around 2-3 minutes in length.

If you have DPCM files, less than that. IDK? 80 songs?

Edit...
the victory song is about 70 bytes, and the level song is more like 300 bytes.

250/0.3 = 800 songs, using SMB system.
nesdoug.com -- blog/tutorial on programming for the NES
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: How many tracks can a NES cartridge have?

Post by lidnariq »

Quickly checking a giant pile of NSFs, and ignoring any NSFs that have only one track...

The average (mean) efficiency is 1400 bytes per track. The most common (median) efficiency is 870 bytes per track.

A lot of rips include sound effects, which moves the average down a lot. If I use a substantially smaller corpus that I think doesn't include any sound effects, the median barely changes (890 bytes). The games with the most actual songs look like FF3j (58 tracks, 991 bytes per track), Metal Slader Glory (53 tracks, 3866 bytes per track), Wai Wai World 2 (48 tracks, 1709 bytes per track), and Earthbound (47 tracks, 363 bytes per track). I'm probably missing some.

In the corpora I'm looking through, so many rips contain non-music data that I can't easily find a "most bytes per track" example.
User avatar
gravelstudios
Posts: 159
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

Re: How many tracks can a NES cartridge have?

Post by gravelstudios »

Also, it really depends on how much space the developers wanted to devote to music data. Super Mario Bros only has a handful of tracks because it's a small tightly packed ROM. A game that uses bank switching could theoretically have as much music as as you are willing to devote the space to (possibly at the expense of having less room for other game data).
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How many tracks can a NES cartridge have?

Post by tepples »

lidnariq wrote: Sun Apr 18, 2021 6:05 pm In the corpora I'm looking through, so many rips contain non-music data that I can't easily find a "most bytes per track" example.
Is it helpful to plot the number of channel-seconds for each track and then use that metric to cluster tracks into sound effects, jingles, and background music?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: How many tracks can a NES cartridge have?

Post by lidnariq »

tepples wrote: Mon Apr 19, 2021 7:19 am Is it helpful to plot the number of channel-seconds for each track and then use that metric to cluster tracks into sound effects, jingles, and background music?
Probably? I was looking for the simplest thing that could possibly work (inspect file size, inspect "number of tracks" byte), and didn't get as far as asking how I'd further improve it.
User avatar
MrNorbert1994
Posts: 985
Joined: Tue May 06, 2014 1:50 pm
Location: Szeged, Hungary
Contact:

Re: How many tracks can a NES cartridge have?

Post by MrNorbert1994 »

There are a lot of things depending on how many songs can a cartirdge have.
As an NSF ripper, the max file lenght can be 1MB only, and NSF can handle 255 tracks. Should the game use DPCM or not? If yes, then you have to calculate how many samples you want, and how much it will eat up from $C000-$FFFF. Not to mention, if somebody wants to use DPCM, then it would be a wise choice to write the entire code and sequence data as well into this field to avoid bankswitching. Some games have long tracks since they use repetition commands a lot, and they only eat up just a few bytes. Some companies like Realtime Associates use a sort of driver that instantaneously loads the note data, and even tough the tracks are around 1 minute mark they can eat up like... 1500 bytes per song. Some games store the music data in several banks, and if the entire driver can fit into under 32KB a ripper would have to mave the entire segments and code to avoid bankswitching. Also a lot of games (Kemco for example) has around 1000 bytes of code that is stored in $F000-$FFFF, yet the sequence and index pointers are around $8000-$AFFF. Again the whole code needs to be moved.
It's not unusal from a commerical game to have like 40-50 tracks, or prehaps even 60 + / - sound effects.
User avatar
Tuï
Posts: 10
Joined: Sun Apr 26, 2020 8:12 am

Re: How many tracks can a NES cartridge have?

Post by Tuï »

In my personal experience (and my way of doing tunes), i can see a rule of thumb like : 750b = around 30s of music.
Last edited by Tuï on Wed Apr 21, 2021 7:09 am, edited 1 time in total.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How many tracks can a NES cartridge have?

Post by tepples »

An estimate of 750 kB for 30 seconds (200 kbps) is probably accurate for a game for a PC or modern console. It's way too big for a platform with a PSG, such as Game Boy or NES.
User avatar
Tuï
Posts: 10
Joined: Sun Apr 26, 2020 8:12 am

Re: How many tracks can a NES cartridge have?

Post by Tuï »

ye actually i meant 750b ^^, i changed my reply
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How many tracks can a NES cartridge have?

Post by rainwarrior »

1500 bytes per minute does seem about the right ballpark, in my experience, at least when not using DPCM samples.

DPCM samples are typically 500-2000 bytes each for a short sound, but on the other hand in most cases we only use a small set of them.

Also this assumes that the music was written deliberately with small data size in mind. It's easy to write music in Famitracker that is hugely inefficient with data. You can burn through bytes much more quickly if you work at a high playback speed and write lots of notes and effects, and don't take advantage of pattern repetition.

My 45 minute Dark Side of the Moon album ROM seems to be about 2k / minute, if we're counting just the music data. (Includes some DPCM, and wasn't trying to conserve repetition.)
Last edited by rainwarrior on Wed Apr 21, 2021 2:24 pm, edited 2 times in total.
kuja killer
Posts: 130
Joined: Mon May 25, 2009 2:20 pm

Re: How many tracks can a NES cartridge have?

Post by kuja killer »

geeez 1500 bytes is considered normal ?? your sure/serious ?? I thought that would be waaaay too much. Because.

Most of the songs in megaman 3 are only about 300 to 500 bytes on average. Thats what i was always used to seeing. I would un-fortantely complain (NOT intentional) to a music composer named "rrtheil" who made some of the songs for my romhack "megaman odyssey" when the songs he made in famitracker program, do things like the "change volume in the middle of a note" HUNDRDEDS of times total throughout the song.

Like "Volume A in the first 2 rows of a note, then volume 6 in the next 2 rows of the same note" for example... for a fade out effect i guess ? -- And i didnt like that because it would eventually eat up soooo much more space when i translate that to megaman 3-6's sound format. it's like an extra 2 to 4 bytes for every time you use that Volume command, i forget.

Or like 90 instances of "pitch slide" or "change song speed" every half a note, etc etc. - I was worried about the space it would take up. So im like ...im so sorry but i cant afford to do those hundreds of volume commands everywhere. Cause it'll easily make the song between 1000 to 1800 bytes, if not longer even. Who knows. :(

I'm not very good at knowing the best tricks on how to do things easier with the mm3-6 sound format.

The boltman song on my game is currently the longest at around 1100. and i thought THAT was insanely long...but if you guys are really serious about 1500 being the "normal" ...holy cow. :( I sure had no clue before i saw this topic.
Last edited by kuja killer on Wed Apr 21, 2021 2:13 pm, edited 1 time in total.
Post Reply