8bitmatt wrote:Thanks guys! This is great! I literally spent a few hours last night trying to find this info to no avail. It's amazing how many dead links there are when searching for mml stuff.
~J-@D!~ wrote:You can simply use "D16" in the D track.
Use EP macros when you want to activate/deactivate looped noise in a macro.
This rules. I get no errors when compiling and its works as expected. So why does this work? What is the command doing?
I don't have th esource here, so I can be wrong.
But basically, PPMCK encodes notes into a byte with the high nibble being the octave and the low nibble, the scale. With harmonic channels, the lower nibble is used to find a frequency and the octave information alter the frequency (on most channels, which are period-driven, it should be used to shift right N times, N being octave).
With the noise channel though, octave information is discarded and there is no frequency table, instead the lower nibble is used directly, altered with the current pitch offset (either with D and/or EP macro) and is written to $400E.
This is the $400E register according to apu_ref.txt:
Code: Select all
$400E s--- pppp short mode, period index
We must know to that for period-based channels, the current pitch offset is substracted from the calculated frequency value instead of being added; when doing "A D3 c e g" for example, pitch goes up (intuitively).
What "D16" does to the noise channel though, is substract "16" from the note lower nibble, giving values in the range $F0 - $FF, and writing those values to $400E will activate the short looped noise.