Page 1 of 1

Hardware Sweeps And Envelopes

Posted: Thu Jan 07, 2010 5:32 am
by neilbaldwin
Just polling opinion as I've always eschewed these hardware features in my audio coding. No real reason other than I've never seen much point when you can do them better and more flexible in software.

However, I thought of adding a command to my tracker that lets you write numbers directly to the registers (yes, stolen from MCK/MML etc.), the main benefit being you could take advantage of the hardware sweeps etc.

But is there any point? I don't know much about any games that have made special creative use out of those features over and above what could be done in software.

I'd be interested in opinion and examples, if anyone has any. :)

Neil

Posted: Thu Jan 07, 2010 5:47 am
by Bregalad
Definitely yes for the sweep. It allows the pitch to change more often than what you can do with sound code running each 1/60 of a second, all sound effects of Konami games (and many others too) hevily relies on this. For example the explosion sound in countra could never be done without hardware sweep (unless the sound codes runs 4 times a frame or something like that).
Many games also uses Sweep in music, Double Dragon and Final Fantasy III comes in mind, but there is others.

I don't think the decay or length counters are too usefull - exept if you have a very simple sound code.

Posted: Thu Jan 07, 2010 9:01 am
by Memblers
The linear counter for the triangle channel is 240Hz, so it can make so really short tones. The 'parachuting in' music from Rush 'n Attack/Green Beret is one example, also a song in Top Gun does the same trick.

The most absurd feature though is the 'looped volume envelope'. I've only noticed 2 games that use it, Magmax and Mappy. Probably other Nihon Bussan titles as well. Magmax though is a just packed with hilarious hardware-effect sounds. :)

Sweeps can be pretty nice, but don't seem all that easy to use for specific tones. Double Dragon had the best use of it in music that I can think of. In any event it would be really great to have a command to write to any register.

Actually there is another rarely used (but more subtle) hardware effect involving the $4011 register. Changing that register slightly effects the volume of the triangle and noise channels channels. But it has to be ramped up and down in smooth steps, otherwise there will be audible pops. I've only ever seen one game do this, and that was Star Tropics 2. It's probably not worth bothering with, but it is a very obscure effect.

Posted: Thu Jan 07, 2010 9:42 am
by neilbaldwin
Memblers wrote: In any event it would be really great to have a command to write to any register.
That's what I'm going to do. Should be fun :D

Posted: Thu Jan 07, 2010 10:24 am
by Bregalad
Memblers wrote: The most absurd feature though is the 'looped volume envelope'. I've only noticed 2 games that use it, Magmax and Mappy.
The goonies when you loose (it sounds like a glitch, but no it's on purpose).
BTW The second most absurd feature is the non-linear counter avialable for square and noise channel.
I've only ever seen one game do this, and that was Star Tropics 2. It's probably not worth bothering with, but it is a very obscure effect.
Life Force use that when fading music out, there might be other games as well.

Posted: Thu Jan 07, 2010 12:48 pm
by Dwedit
The envelopes are utterly worthless, except when you need to make a really small sound engine, or need that authentic first-gen sound.

Posted: Thu Jan 07, 2010 12:49 pm
by tepples
Bregalad wrote:
Memblers wrote:The most absurd feature though is the 'looped volume envelope'. I've only noticed 2 games that use it, Magmax and Mappy.
The goonies when you loose (it sounds like a glitch, but no it's on purpose).
I seem to remember that Klax uses it too.

Posted: Thu Jan 07, 2010 4:18 pm
by neilbaldwin
Oh MAN!

I've just spent a couple of hours playing with the various sweep settings and when I was comfortable with what they do I had the idea to put the command to set the sweep register in my Pitch Table code.

Just spent the trippiest 30 minutes with one looping pattern switching between two different sweep settings in real time. You can get some amazing effects by, say, setting a fast down sweep, delaying a couple-three frames and then reversing the sweep.

What have I been missing!

:D

Posted: Sat Jan 09, 2010 5:31 am
by neilbaldwin
I'm having trouble at the moment stabilising the voices when I want to turn the sweep off.

In my pitch table, if I try to turn off the sweep for a few of frames at the start of a note, then switch it on for remainder, the pitch goes all over the place for each note played, instead of starting at the pitch of the note (which is what I'm trying to achieve).

In the pitch table code, the sweep register will definitely be cleared before I write the note frequency (which is how I assume it should be done) but, ironically, if I *don't* clear the sweep register, each note starts from the right pitch (as the $4002 and $4003 get rewritten on each key-on).

Anything to watch out for?

Posted: Sat Jan 09, 2010 1:20 pm
by Bregalad
Well I think it works like the following : Each reg 2 and reg 3 writes overwrite the corresponding bits of the pitch by the new one you're writing, but the sweep will continue to go up/down whenever the APU gets a clock in the absance of any new reg 1 write.

When disabling the sweep (can be done both by clearing all bits 0-2, or clear bit 7) you must write a value with bit 3 to '1', else the lowest octave will silence !

Posted: Sat Jan 09, 2010 3:25 pm
by neilbaldwin
Bregalad wrote:Well I think it works like the following : Each reg 2 and reg 3 writes overwrite the corresponding bits of the pitch by the new one you're writing, but the sweep will continue to go up/down whenever the APU gets a clock in the absance of any new reg 1 write.

When disabling the sweep (can be done both by clearing all bits 0-2, or clear bit 7) you must write a value with bit 3 to '1', else the lowest octave will silence !
That's pretty much my understanding and is the way I'm using the registers.

It's my guess that when you disable the sweep that it doesn't disable *immediately* and so when I;

- disable sweep
- write new note data to $4002/$4003

in a short space of time (same frame) that the sweep is still active for a minute amount of time and that the sweep modifies the new note data before truly disabling.

Or that you have to do things in a certain order?