Looped Noise in ppmck Channel D @1

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Looped Noise in ppmck Channel D @1
by on (#90268)
Is it possible to make the 'looped noise' actually work with ppmck?

When trying to use @1 (or even @0) on the D channel (as described here) you get an error when compiling.

Code:
8: Unuse command in this track


Using ppmck "release 8" shows the error but still compiles. Using ppmck "release 9 ex5" (the latest I've been able to find) shows the error and fails to compile. Remove the @1 or @0 on channel D and both versions compile with no errors.

This really complete ppmck guide doesn't mention the looped noise option. Although at the bottom in the "Quick Track Table" section, it does suggest that the command should be available.

by on (#90272)
You can activate it with a simple pitch envelope.

by on (#90273)
@EP0={-4 | 0}
@EP1={16 | 0}
@EP2={12 | 0}
D t120 o0 v8 c d- d e- e f g- g a- a b- b EP0 a- a b- b
D t120 o0 v8 EP1 c d- d e- e f g- g a- a b- b EP2 a- a b- b

by on (#90298)
You can simply use "D16" in the D track.

Use EP macros when you want to activate/deactivate looped noise in a macro.

by on (#90302)
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?

by on (#90307)
~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.


Weird. I abuse ep with noise more than I should so I never noticed that one!

by on (#90311)
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?

"D" is detune...it works on all channels except E (I think).

I've never tried it on the noise channel...brilliant find ~J-@D!~!

by on (#90403)
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:
$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.