Thanks.
Did you fail to understand the concept of attack and sustain portions, or did you fail to understand the concept of overwriting? It matters little; I'll explain both.
Attack and sustain portionsThis section assumes familiarity with FamiTracker envelopes and with volume fade effects in trackers. Consider the following volume envelope:
Code:
___
_| |___
| |___
| |_______
_| . |_______________
| . |_______________
| . . |____________
| . .
| . . . . . . . . . . . . . . . . . . . . . . . .
4 7 8 8 7 7 6 6 5 3
Attack phase Sustain phase
You set an attack envelope 4 7 8 8 7 7 6 6. Then you set a sustain envelope starting at 5 with a decrease rate of 2, which produces a slope of -2 units per 16 frames, or -1/8 amplitude unit per frame.
Envelopes in my music engine are slightly more complex than this to allow for pitch and duty control, but this simplified model should help you begin to understand.
Attack injectionNormally the music engine has have five tracks going, each with its own position in a musical phrase:
- A standard melodic track that plays on pulse 1
- A standard melodic track that plays on pulse 2
- A standard melodic track that plays on triangle
- A track that triggers sound effects, used to create drums
- A track that can replace the attack on pulse 1, pulse 2, or triangle with a different note
Tracks 1, 2, and 3 are directly mapped to a hardware APU channel. Playing a note on one of these loads the variables for that channel's attack and sustain phases. If the remaining attack length is nonzero, it plays the attack one frame at a time; otherwise, it runs the sustain.
Track 4 is mapped to a drum kit. Each entry in a 25-entry array consists of two sound effect numbers. Usually one sound effect is on the noise channel and the other on the triangle channel if needed. Triggering a sound effect of the form "triangle portion of kick drum" allows triangle drums to interrupt the bass line.
Track 5 doesn't have its own hardware APU channel. Instead, it has a pointer to another channel (pulse 1, pulse 2, or triangle). When a note is played on track 5, the track overwrites that other channel's attack with the attack portion of the instrument chosen for track 5. This pauses the other channel's sustain until the attack finishes.
What you're hearing in this NSF is a bass line on track 3 and an instrument with a one-frame pop attack on track 5. Track 5 is set to write attacks on top of track 3, which causes its sustain to pause until the attack is finished. Because the attack has a different pitch, tracks 3 and 5 are effectively time-sharing the triangle channel. It's the melodic counterpart to triangle drums.