You can also store a period table with 12 notes in the lowest octave, and right-shift for higher octaves. If you feel the need to correct for rounding error, you can store an additional table with 12*(number of octaves) bits, but once you take into account the extra code to make use of the second table, I'm pretty sure it would be bigger than your 28-note table.Nameguy wrote:Firstly, I will address the period table.[...] 9 * 3 = 27, + C4 = 28 notes seem sufficient for a plethora of musical content based on what I've yet written.
Newcomer to NES programming
Moderator: Moderators
Re: Newcomer to NES programming
Re: Newcomer to NES programming
Octave doubling... it's genius. I wish I'd thought of that!Joe wrote:You can also store a period table with 12 notes in the lowest octave, and right-shift for higher octaves. If you feel the need to correct for rounding error, you can store an additional table with 12*(number of octaves) bits, but once you take into account the extra code to make use of the second table, I'm pretty sure it would be bigger than your 28-note table.
I do think I'll put the major seventh back in. Adding 3 notes goes from 28 to 31, which is still addressable in 5 bits.tepples wrote: In a minor key, you'll need both the "natural" seventh for III chords and the "harmonic" major seventh for V chords. For example, E minor needs E, F#, G, A, B, C, D, D#, and E.
I noticed many of my songs have a high note density, but a relatively constant note duration. For example, a single channel on one of my songs totals 256 2-byte notes, each the same length.
I'm considering using a fixed-duration method, where each channel stores a constant duration in the metadata. (If tempo is stored, the constant could be stored in 2-bit fractional units, letting 4 channels store them in a byte, but that's probably unnecessary.) Removing the duration value reduces the 15-bit notes to 9, and halving the volume resolution (storing 0-7 values and doubling them before sending to register) reduces them to 8 bits, halving the note size.
Since 3/4 the notes alter the volume and not pitch, omitting half the notes would have little audible effect on the music.
Compounding these modifications, the data size for the channel would be 128 bytes, a quarter the original size.
EDIT:
Since pitch doesn't matter when note volume is off, nonzero pitches can be used to issue commands to the engine. e.g. volume of 0, pitch of 1 could change the duty cycle, pitch of 2 increases the all following notes' pitches by an octave, etc. Since the engine identifies these special conditions, it can know to read as many bytes ahead as needed for the command, e.g. several notes for arpeggios.
Re: Newcomer to NES programming
Oh, cool! You're still here! Being busy with real life is fine, hell, I've been busy with commission (art) work, so this game has taken the back burner for the most part. I work on it whenever I have the free time.Nameguy wrote:I apologize for not having posted in this thread - or forum - for several months. I've been caught up with real life and other projects.
A pattern is just a way of compressing looped sections of songs into a single copy, and calling it as needed. .MOD/.XM music does this a lot.Nameguy wrote:Final note: I nowhere mentioned patterns, which many engines use (presumably; I know little about them) to greatly compress song size. I've omitted them, not only to simplify the design, but to encourage minor variations in my composition of repetitive tracks, rendering the resultant music more interesting.
If your compression method can justify the extra data, go right ahead! I have no problem with that!Nameguy wrote:Is my approach a bad idea? Am I forgetting an integral component? Is there a smaller way of storing music? Is this whole thing a mess? I'd love to hear some feedback.
For example: I have managed the AI for 18 unique monsters (no bosses yet), programmed in well under 1KB, Their logic loops are only 8 *bytes* each! (I abused the crap out of generalized, modular code for the update loop.)
So far:
Bank 0, contains the game logic (game loops, reading/writing)
Bank 1, contains table data (enemy/object configuration)
Bank 2, contains the maps (2 formats, one for detail (title/intro), the other for game screens)
I haven't even so much as *touched* bank 3 yet, so that's 8KB open to... whatever!
(Actually that's a lie, I'm using 6 bytes for mandatory padding, I hope you don't need *those!* )
Re: Newcomer to NES programming
@Nameguy
If you're serious about producing the music, here is that list I forgot to post, some time ago, it's been sitting at the bottom of zp.asm forever! Sorry it took so long! :S
If at all possible, I would like each dungeon to have a unique track. Thematic to the location.
The dungeon palette, and my rough thoughts on the theme, are present. Ignore the sarcasm/silly comments. : P
0-title/intro ;Title theme, with a lead-in to an intro. (requires a fade-out? unsure.)
1-menu/password ;Relaxed/Happy music, something simple for a new game, or continuing.
2-overworld ;Explorative music, song length is allowed to be longer. Most common song.
3-underground ;Cave music. That's it. Nothing else to say. Mischief/Tension theme.
4-level 1 ;Forest Temple, Green/Blue, Song should be relaxed, introductory dungeon.
5-level 2 ;Desert Tomb, Red/Yellow, Slow/ominous, or fast/creepy. Not sure. DEATH.
6-level 3 ;Lake Shrine, Blue/Green, A water level, people seem to hate these. Make the song memorable, at least.
7-level 4 ;Mountain Stronghold, Grey/Blue, A more serious/action-y theme. Dragons, yo!
8-level 5 ;Underworld, Purple/Red, Last level, the final showdown with death itself.
9-boss 1 ;Main Boss theme, short and intense. You need to know that you're in danger.
A-boss 2 ;The Algol, possibly a longer, drawn-out song? It *IS* the last boss.
B-ending/credits ;Uhh... Not sure about this part, quite yet. A remix of the main theme?
???? ;Possibly additional data, I haven't given sound data too much thought.
Here are shots of the palettes, applied to a dungeon screen (number $25, I think.)
The first two, show the palette difference between a lit and dark room. This game will be slightly less dick-ish than Zelda, in that you can at least *see* the floor. Enemies will still use a black palette though, but at least you can make out their shadows!
The bottom two panels were from an idea, to possibly add a day/night cycle. The game has a clock (pause menu/password), after all! Why not use it? This would potentially be functional to gameplay, changing the enemy groups on overworld screens.
If you're serious about producing the music, here is that list I forgot to post, some time ago, it's been sitting at the bottom of zp.asm forever! Sorry it took so long! :S
If at all possible, I would like each dungeon to have a unique track. Thematic to the location.
The dungeon palette, and my rough thoughts on the theme, are present. Ignore the sarcasm/silly comments. : P
0-title/intro ;Title theme, with a lead-in to an intro. (requires a fade-out? unsure.)
1-menu/password ;Relaxed/Happy music, something simple for a new game, or continuing.
2-overworld ;Explorative music, song length is allowed to be longer. Most common song.
3-underground ;Cave music. That's it. Nothing else to say. Mischief/Tension theme.
4-level 1 ;Forest Temple, Green/Blue, Song should be relaxed, introductory dungeon.
5-level 2 ;Desert Tomb, Red/Yellow, Slow/ominous, or fast/creepy. Not sure. DEATH.
6-level 3 ;Lake Shrine, Blue/Green, A water level, people seem to hate these. Make the song memorable, at least.
7-level 4 ;Mountain Stronghold, Grey/Blue, A more serious/action-y theme. Dragons, yo!
8-level 5 ;Underworld, Purple/Red, Last level, the final showdown with death itself.
9-boss 1 ;Main Boss theme, short and intense. You need to know that you're in danger.
A-boss 2 ;The Algol, possibly a longer, drawn-out song? It *IS* the last boss.
B-ending/credits ;Uhh... Not sure about this part, quite yet. A remix of the main theme?
???? ;Possibly additional data, I haven't given sound data too much thought.
Here are shots of the palettes, applied to a dungeon screen (number $25, I think.)
The first two, show the palette difference between a lit and dark room. This game will be slightly less dick-ish than Zelda, in that you can at least *see* the floor. Enemies will still use a black palette though, but at least you can make out their shadows!
The bottom two panels were from an idea, to possibly add a day/night cycle. The game has a clock (pause menu/password), after all! Why not use it? This would potentially be functional to gameplay, changing the enemy groups on overworld screens.
Last edited by Alp on Sat May 21, 2016 2:58 pm, edited 1 time in total.
Re: Newcomer to NES programming
Well, for starters, you'll want a "Game Over" ditty. It can possibly be an extra bar or two leading into password theme (like how Megaman 2 does it).Alp wrote:???? ;Possibly additional data, I haven't given sound data too much thought.
[...]
(pause menu/password)
Being a Zelda-ish game, you'll probably want "Boss Defeated/Dungeon Complete" and "Item Get" ditties, "puzzle solved" as well, though that's falling a bit into SFX territory.
Re: Newcomer to NES programming
Sorry, short update.
I was busy today, so a lot of the engine work was done the two previous days. I got the pulse & triangle channels working, and started noise.
Most of today was spent with writer's block trying to do song 1.
It has come out in the vein of MM2 & 3 password screens. Also as short as they are.
However I have a pretty good idea what I want to try for song 0 (title) and a few others.
If it's a good idea to release the source code I'll do that, just not until the code is in a better state.
P.S. Does the phase reset on the pulse channels every time you write to 4003? Currently it's making the nastiest clicking sound every update.
I was busy today, so a lot of the engine work was done the two previous days. I got the pulse & triangle channels working, and started noise.
Most of today was spent with writer's block trying to do song 1.
It has come out in the vein of MM2 & 3 password screens. Also as short as they are.
However I have a pretty good idea what I want to try for song 0 (title) and a few others.
If it's a good idea to release the source code I'll do that, just not until the code is in a better state.
P.S. Does the phase reset on the pulse channels every time you write to 4003? Currently it's making the nastiest clicking sound every update.
- Attachments
-
- song1.nes
- (16.02 KiB) Downloaded 168 times
-
- song1_old.nes
- (16.02 KiB) Downloaded 161 times
Re: Newcomer to NES programming
Yes. For this reason, you need to save the last value written to $4003 and $4007 and not write it back it if it hasn't changed. Also avoid vibratos on A notes (or G# on PAL NES) unless you're using obscure tricks with the sweep registers and $4017 to manipulate $4003.Nameguy wrote:P.S. Does the phase reset on the pulse channels every time you write to 4003? Currently it's making the nastiest clicking sound every update.
Re: Newcomer to NES programming
That's the reason for the 60Hz noise on e.g. Dizzy, so I read.
Re: Newcomer to NES programming
Neat! Sounds good!Nameguy wrote:Sorry, short update.
I was busy today, so a lot of the engine work was done the two previous days. I got the pulse & triangle channels working, and started noise.
Most of today was spent with writer's block trying to do song 1.
It has come out in the vein of MM2 & 3 password screens. Also as short as they are.
However I have a pretty good idea what I want to try for song 0 (title) and a few others.
If it's a good idea to release the source code I'll do that, just not until the code is in a better state.
P.S. Does the phase reset on the pulse channels every time you write to 4003? Currently it's making the nastiest clicking sound every update.
Dizzy the Egg! :OMyask wrote:That's the reason for the 60Hz noise on e.g. Dizzy, so I read.
I'm one of about 3 people in North America, who grew up playing these games. Probably.
I tend to work on small pixel pieces while programming, to help myself focus.
I *finally* found a game for that Knight character! It's an NROM-restricted Dragon Quest clone.
(Monsters will take the lower-half of the sprite page, more than enough. That Slime is 6 tiles.)
43 BG tiles so far, 91 counting the 48 for the text.
18 Sprite tiles
If there's room, after drawing all the needed locales, I may add a background for the battles.
Last edited by Alp on Sat May 21, 2016 2:59 pm, edited 1 time in total.
Re: Newcomer to NES programming
Interface is a little on-the-nose for my taste, but looks nice. I'd suggest switching G and E to GP and XP if it weren't for the fact that those fields are the ones that can possibly become 5-digit...unless you reduce the maximum there compared to original-flavor.
Maps are gonna take up more space if you're specifying by 8x8 as on the left rather than by 16x16 as on the right. (One can always calculate when to use edge tiles by surrounding data, but those gaps in the/individual trees/mountains might prove problematic.)
Gonna do character facing like Dragon Warrior or stick with faces-camera-only people like Dragon Quest?
Maps are gonna take up more space if you're specifying by 8x8 as on the left rather than by 16x16 as on the right. (One can always calculate when to use edge tiles by surrounding data, but those gaps in the/individual trees/mountains might prove problematic.)
Gonna do character facing like Dragon Warrior or stick with faces-camera-only people like Dragon Quest?
Re: Newcomer to NES programming
The interface layout is practically 1-1 with Dragon Quests', I haven't decided if I'm going to change it. A scale reduction could work, to improve the readability of the fields, not a bad idea!Myask wrote:Interface is a little on-the-nose for my taste, but looks nice. I'd suggest switching G and E to GP and XP if it weren't for the fact that those fields are the ones that can possibly become 5-digit...unless you reduce the maximum there compared to original-flavor.
Maps are gonna take up more space if you're specifying by 8x8 as on the left rather than by 16x16 as on the right. (One can always calculate when to use edge tiles by surrounding data, but those gaps in the/individual trees/mountains might prove problematic.)
Gonna do character facing like Dragon Warrior or stick with faces-camera-only people like Dragon Quest?
Actually, the maps abuse the hell out of 16x16 meta-tiles, and mid-cluster (index 5) auto-tiling to increase the level of detail. That is, the middle forest tile is systematically replaced by the map loading routine. Just a little trick. Not 8x8 at all.
There's enough room for a fair amount 4-directional NPC sprites. (14 total)
I can possibly get tricky with the shopkeepers, and make them direction-locked, to save the room for more important characters.
Re: Newcomer to NES programming
Ever considered making the text font fancier? (heck, you can even make it use all four colors, e.g. for shading)
Re: Newcomer to NES programming
Nowadays, the command list would be placed at the bottom, just below the end of the text in the text box, because that's where the player is already looking.Alp wrote:I *finally* found a game for that Knight character! It's an NROM-restricted Dragon Quest clone.
(Monsters will take the lower-half of the sprite page, more than enough. That Slime is 6 tiles.)
43 BG tiles so far, 91 counting the 48 for the text.
18 Sprite tiles
If you can come up with a currency symbol, like $ (dollars) or £ (pounds) or ¥ (yen) or ₹ (rupees, useful for buying lamp oil, rope, and bombs) or Ꝑ (the currency in Pokemon) or Ҹ (ciodanti, the currency in RHDE), it should fit in one tile.Myask wrote:I'd suggest switching G and E to GP and XP if it weren't for the fact that those fields are the ones that can possibly become 5-digit...unless you reduce the maximum there compared to original-flavor.
Only if fancy also means readable. The point of text is to convey information. I tried fancy in a few homebrew games over a decade ago, and it caused Cowering to misspell my name.Sik wrote:Ever considered making the text font fancier? (heck, you can even make it use all four colors, e.g. for shading)
Re: Newcomer to NES programming
The "fanciest" I have, is the lower-case half of that "Arcade" font of mine.Sik wrote:Ever considered making the text font fancier? (heck, you can even make it use all four colors, e.g. for shading)
I'm currently putting off using it, as it uses 1/3 of the CHR!
Actually, it's funny you mention symbols, I was planning on adding symbols for inventory items, to make it easier to identify things at a glance. (Potion icon for consumables, Sword for weapons, etc.)tepples wrote:If you can come up with a currency symbol, like $ (dollars) or £ (pounds) or ¥ (yen) or ₹ (rupees, useful for buying lamp oil, rope, and bombs) or Ꝑ (the currency in Pokemon) or Ҹ (ciodanti, the currency in RHDE), it should fit in one tile.
If I can figure out a symbol for gold, and exp, I will add it!
Last edited by Alp on Sat May 21, 2016 2:59 pm, edited 1 time in total.
Re: Newcomer to NES programming
tepples wrote:Only if fancy also means readable. The point of text is to convey information. I tried fancy in a few homebrew games over a decade ago, and it caused Cowering to misspell my name.
(・_・)
Incidentally the suggestion came because I couldn't stand how certain letters looked (especially the I with its uneven stroke, I'd rather have uneven spacing instead).