How many tracks can a NES cartridge have?

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

Moderator: Moderators

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 »

kuja killer wrote: Wed Apr 21, 2021 2:04 pmMost of the songs in megaman 3 are only about 300 to 500 bytes on average.
No, they are about 1k on average. I think you're not counting instruments or the music driver, which are a cost that distributes across the whole soundtrack.
kuja killer wrote: Wed Apr 21, 2021 2:04 pmThe 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.
1500 per minute was the ballpark average I was giving, not per track, though maybe most of the MM3 tunes are about 1 minute long before the loop?
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 »

I don't mean the music engine's code or the invidiaul instruments (8 bytes apiece) im talking about just the song itself only. And i assumed thats what you guys meant too. and in "hex" talking terms, not decimal.

I have a document from 10+ years ago where i documented the exact length of every song in mm3. Here i'll show you.
--------------------------
edit: oh "per minute" sorry. I see now. yea that makes sense.
1500 bytes "decimal" is 5DC hex... i always think in hex personally.
Attachments
MusicData.rtf
(24 KiB) Downloaded 82 times
Last edited by kuja killer on Wed Apr 21, 2021 2:59 pm, edited 1 time in total.
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 »

You can get pretty efficient if you think carefully about repetition, and especially if you compose in a format that's close to the eventual data format.

Like I expect the situation at Capcom was probably having a technically minded composer directly type bytes into the stream of music data. With nothing hiding the size of what you're doing from you, you can quickly gain experience about how to write music that is also compact.

I think the most impressive size vs. result I've seen in NES music is actually Donkey Kong. All the music code and sound effects and data take up only 1.7k. I think that still kinda does work out to close to 1500 bytes per minute, but because it's such a tiny size the engine code here has a much greater proportion than with soundtracks that have much more music in them and get to reuse it, which is why it's so impressive to me.
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 »

That document is interesting, though I'd wonder how big the stuff not accounted for is, especially the music code. The Mega Man 3 NSF has about 4k worth of stuff beyond the listed song data.

Putting into a spreadsheet it lists 24 tracks, average 643 bytes of just song data each, though their lengths vary a lot, and there's several very short tracks bringing the average down a bit. Including the other data it might be more like 750 bytes. (When I said ~1k, I had only counted 20 tracks.)

For comparison, here's the data stats for Lizard:

Code: Select all

Macro count: 216
Instrument count: 178

Macro size:       3140 bytes
Instrument size:   712 bytes
Order size:       1014 bytes
Pattern size:    24390 bytes
SFX size:         1383 bytes
Misc:               38 bytes
TOTAL:           30677 bytes

Macro type 0:     1890 bytes in 102 macros (volume)
Macro type 1:      395 bytes in  50 macros (arpeggio)
Macro type 2:      665 bytes in  41 macros (pitch)
Macro type 3:        0 bytes in   0 macros (hi-pitch)
Macro type 4:      180 bytes in  21 macros (duty)

Song  0:            21 bytes in   2 patterns (SILENT)
Song  1:          1370 bytes in  30 patterns (RUINS)
Song  2:          1382 bytes in  29 patterns (MAZE)
Song  3:          1649 bytes in  21 patterns (MARSH)
Song  4:          1469 bytes in  32 patterns (FOREST)
Song  5:          1353 bytes in  29 patterns (PALACE)
Song  6:          1356 bytes in  27 patterns (LAVA)
Song  7:           921 bytes in  25 patterns (WATER)
Song  8:           846 bytes in  13 patterns (LOUNGE)
Song  9:           938 bytes in  21 patterns (ROOTS)
Song 10:          1832 bytes in  38 patterns (RIVER)
Song 11:          2163 bytes in  38 patterns (STEAM)
Song 12:          1455 bytes in  30 patterns (VOID)
Song 13:          1203 bytes in  23 patterns (MOUNTAIN)
Song 14:          1561 bytes in  37 patterns (VOLCANO)
Song 15:           266 bytes in  10 patterns (SANCTUARY)
Song 16:          2580 bytes in  26 patterns (BOSS)
Song 17:          2488 bytes in  33 patterns (ENDING)
Song 18:           589 bytes in  25 patterns (DEATH)

SFX  0:              4 bytes (NONE)
SFX  1:             27 bytes (JUMP)
SFX  2:             43 bytes (BONES)
SFX  3:             31 bytes (WATER)
SFX  4:             18 bytes (SWITCH)
SFX  5:             28 bytes (COIN)
SFX  6:             16 bytes (NO)
SFX  7:             40 bytes (FIRE)
SFX  8:             20 bytes (SWIM)
SFX  9:             28 bytes (BOUNCE)
SFX 10:             22 bytes (SIP)
SFX 11:             27 bytes (BLOW)
SFX 12:             12 bytes (FIRE_CONTINUE)
SFX 13:             20 bytes (STONE)
SFX 14:             14 bytes (PUSH)
SFX 15:             15 bytes (TALK)
SFX 16:             30 bytes (BOSS_DOOR_OPEN)
SFX 17:             30 bytes (BOSS_DOOR_CLOSE)
SFX 18:             13 bytes (ARROW_FIRE)
SFX 19:             14 bytes (ARROW_HIT)
SFX 20:             24 bytes (SPLASH_SMALL)
SFX 21:             18 bytes (PANDA_SIGH)
SFX 22:             22 bytes (PANDA_SWIPE)
SFX 23:             23 bytes (SNAPPER_JUMP)
SFX 24:             23 bytes (BARK)
SFX 25:             17 bytes (GOAT_JUMP)
SFX 26:             25 bytes (GOAT_SPLAT)
SFX 27:             14 bytes (OWL_FLAP)
SFX 28:             38 bytes (ARMADILLO)
SFX 29:             20 bytes (LATCH)
SFX 30:             36 bytes (SWISH)
SFX 31:             31 bytes (DROP)
SFX 32:             40 bytes (SAD)
SFX 33:             36 bytes (DIVE)
SFX 34:             40 bytes (SAD_HIGH)
SFX 35:             74 bytes (TWINKLE)
SFX 36:             15 bytes (DRIP)
SFX 37:             84 bytes (SECRET)
SFX 38:             23 bytes (PENGUIN_FEAR)
SFX 39:             30 bytes (PENGUIN_HATE)
SFX 40:             49 bytes (STEAM)
SFX 41:             44 bytes (BOO)
SFX 42:             15 bytes (DRAWBRIDGE)
SFX 43:             22 bytes (VALVE_CLOSE)
SFX 44:             51 bytes (SMASH)
SFX 45:             24 bytes (ICEFALL)
SFX 46:             32 bytes (HARE)
SFX 47:             26 bytes (WATT)
SFX 48:             35 bytes (WOFF)
This doesn't include the code part, which is probably another 1.5k. Altogether that's pretty close to the 1500 bytes per minute estimate, as I think the soundtrack is about 20 minutes of music.
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 »

are you talking in "decimal" and the other guys ? i edited my last post to mention that. Cause i was confused if you guys were talking in dec, or hex. (i only think and look in hex) ...so when i saw "1500 bytes" i thought that was in Hex, which sounded crazy to me, because that's barely just 1 song in a single 2000 byte (hex) bank.

also the remaining 1000-ish bytes from 31000 to 31FFF in megaman 3, while that can contain music/song data. yea that space was regular game code for Stage Select, Password screen and a few other things. (nothing to do with the music engine whatsoever)
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 »

Most use a convention of $ prefix if you want to indicate hex. Alternatively, h suffix, or maybe less commonly 0x prefix.

$22
22h
0x22

All of these are understood as hex.

3A00

Yes that would probably be understood as hex from the letters.

3800

This I would assume decimal unless given some strong reason to think otherwise.
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 »

i know what all that means, i just meant... were all you guys only referring to your numbers in regular decimal form ?? cause thats why it sounded crazy and outrageous to me at first... cause i "look" or see through my eyes anyone mentioning "bytes" as hex... as 1500 bytes "hex" is waaaay too much for just 1 minute.

if you meant 1500 decimal, which is just under 600 bytes "hex" ...then that's much more reasonable for song length's.
It was even more confusing when you said the average megaman 3 song (after looking at my doc) was 643 bytes... because the protoman/game ending song (longest one) is 500-something.

So should of referred to hex form, not dec. that was real confusing. so you really MEANT to say (or what i "see")... the average was 283 bytes "hex"

i apoligize for going off topic, babbling on and on about this :|
ive spent my life always with FCEUX hex editor for doing all my coding stuff. thats why :|
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How many tracks can a NES cartridge have?

Post by Pokun »

I think most people always assume decimal numbers (with kilo meaning "1024", only media makers are silly enough to actually use kilo as "1000" in digital engineering) if there are no special notations, so you must use one of the hex notations whenever you use hexadecimal numbers or you will just be misunderstood.
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: How many tracks can a NES cartridge have?

Post by lidnariq »

Pokun wrote: Thu Apr 22, 2021 4:44 am only media makers are silly enough to actually use kilo as "1000" in digital engineering)
Compare:
Bandwidth
Resolution
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How many tracks can a NES cartridge have?

Post by Pokun »

I'm not following. You mean those are cases where kilo = "1000" makes sense in digital engineering?
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: How many tracks can a NES cartridge have?

Post by lidnariq »

I mean kilo≠kibi. I mean you've been misled by lazy software developers for decades, and that's the only reason you think that conflation is a reasonable thing. Spinning rust never cared about powers of two - neither the number of heads (other than that 2 and 4 are both small numbers), nor cylinders, nor sectors per track were necessarily or even often a power of two. RAM and programmed ROMs are the only things where the power of two is part of the intrinsic structure.

But to dogmatically say "kilo means 1000 in every context except a few when it means a number that's mysteriously 2.4% bigger" is just asking for trouble, and it gets worse as you go up (4.9% bigger, 7.4% bigger, 10% bigger).
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How many tracks can a NES cartridge have?

Post by Pokun »

Well, I agree that inventing a new meaning for kilo was a clumsy decision, and it would have been better if they had come up with a new prefix (which now is kibi etc) to begin with.

I don't understand why disks are different from ROM and RAM though? Aren't they also storage for memory of binary units? Even though they don't seem to come in quantities of the power of 2 as much as the former.
Isn't power of 2 used all the time in digital engineering?

And I don't see why media makers suddenly had to start using the conventional use of kilo (which isn't what will be displayed on the screen with most programs reading the disk), and on top of that even failing to write the correct value for the actual unformatted space the media has, every time. Talk about confusing the customers to no end. I guess factory bad blocks in things like FLASH are part of it though which might be unavoidable.
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: How many tracks can a NES cartridge have?

Post by lidnariq »

Pokun wrote: Thu Apr 22, 2021 2:05 pm I don't understand why disks are different from ROM and RAM though? Aren't they also storage for memory of binary units? Even though they don't seem to come in quantities of the power of 2 as much as the former.
Sectors are a power of two because they originally were copies of segments of RAM. But there's no excuse for why that should be relevant at any larger scale.
Isn't power of 2 used all the time in digital engineering?
Only when there's a stage where there's physically N address bits, either in space or time.
And I don't see why media makers suddenly had to start using the conventional use of kilo (which isn't what will be displayed on the screen with most programs reading the disk),
They didn't. They always reported powers of 10 on the packaging. It's just that in the MB era, in combination with the lack of the internet, that 5% difference wasn't enough for people to regularly notice the difference. But GiB/GB = 1.074.
and on top of that even failing to write the correct value for the actual unformatted space the media has, every time.
Floppy disks have a wholly unreasonable amount of unformatted space. And in a way, it's another collision of powers of two versus powers of ten. (PC floppy disk bandwidth is 250/300/500/1000kbit/s, and revolution speed is 5 or 6Hz. So a 360kB 5.25" floppy can hold 6250 bytes per cylinder, and more is lost to inter- and intra-sector padding.
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 »

Pokun wrote: Thu Apr 22, 2021 2:05 pmAnd I don't see why media makers suddenly had to start using the conventional use of kilo (which isn't what will be displayed on the screen with most programs reading the disk), and on top of that even failing to write the correct value for the actual unformatted space the media has, every time. Talk about confusing the customers to no end. I guess factory bad blocks in things like FLASH are part of it though which might be unavoidable.
I don't think it's sudden. They did it since the beginning and just never stopped. Software and binary-addressed memory really are the only places that 1024 is the standard.

Software file systems have always worked with power of 2 sectors, as far as I've seen. There's good reasons for that, and a lot of good reasons that 1024 makes good unit there. I'm not prepared to to call anyone "lazy" for making that choice. Reusing kilo, yes maybe that was confusing. It was less confusing when they got started and things didn't commonly even have megabytes of storage yet.

As for hard drives today... yeah I do think it's hella confusing to customers. They know their customers OS will use 1024, and they know most will not expect it, but I don't think they'll ever stop doing it. If they started using 1024 now then their numbers would look smaller than their competitors.

I don't think bad blocks in flash are even part of this problem. They're not using 1000 to cover that stuff up, they're already accounting for that before they tell you the 1000-based size of things.

Though... I guess flash actually is internally power-of-two based in a lot of ways, but again they're competing with hard drives, so good luck convincing them to change anything. :P

FWIW I think casually using the term "kibi" is as confusing as the casual assumption that "kilo" is 1024 in software contexts. As are assertions that what case you use for "k" or for "b" should be able to unambiguously tell someone what kind of units you're really using. Some people are familiar with these conventions, most aren't.

In most cases I would prefer to use the most familiar term, despite the ambiguity, and either the context comes across that it's 1024, or it's a context where the difference between 1024 and 1000 is mostly unimportant. There are rarer cases where I really do want to use kibi. I would almost never expect to use kB or Kb or KB or kb and have someone understand how they are supposed to be different.
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 »

lidnariq wrote: Thu Apr 22, 2021 2:25 pm]Floppy disks have a wholly unreasonable amount of unformatted space. And in a way, it's another collision of powers of two versus powers of ten. (PC floppy disk bandwidth is 250/300/500/1000kbit/s, and revolution speed is 5 or 6Hz. So a 360kB 5.25" floppy can hold 6250 bytes per cylinder, and more is lost to inter- and intra-sector padding.
I feel in a lot of ways, the amount of space wasted by floppy disk formatting is proportional to how long the data on it should be expected to last.

At least, in the long term I've seen so many more failiures when trying to read old disks that had some kind of "oversize" formatting versus something like IBM's more conservative formats. Copy protection methods tend to throw yet another wrench into the problem. Failures happened in the short term too, but when you add a few decades to the problem you really start to see it writ large.

When I started looking for it, I noticed that a lot of older software manuals have addresses where you can mail your original floppy back to get it re-written if the data on it doesn't work. I even saw a recent Apple II release get bitten by problems with their custom floppy disk format.

Of course, few people using floppies nowadays expect their data to last anyway. ;)
Post Reply