Note-Instrument-Stop tests for 1.18

Started by Harbinger, February 20, 2010, 19:20:52

Previous topic - Next topic

Harbinger

The following was written up describing tests i had to make for determining the differences between the track formats on how note processing is handled based not only on instrument designation but also note stops within a channel. These findings will go into the OHM, but i need errors in these conclusions brought to my attention. The devs may also spot some minor details that need to be mentioned, based on the code, or perhaps notice that something i've described here is NOT supposed to happen. Responses will be addressed for the next release of the OHM.

RESULTS:
When calling a note without a sample ID, the note is PROCESSED but not played. This means a timer is started for the channel as if the note were playing.  Note processing continues until the sample playback reaches the end of the waveform (sample loops prevent this), or a new note, a note stop, or a channel reset is called in the channel. Calling a new note always resets note processing.
If a sample is called later (without the note) it will be applied to the note process, and if the sample has not been played to the end, it will pick up at that point.
If the sample ID is called after the waveform has been processed (reaches the end of the waveform, had it been playing that whole time), the note will not sound.
After a sample ID has been called in a channel, it will be remembered until the channel is reset.

MOD
C00 sets the channel (and therefore note) volume to 0 but does not reset note processing.
EC0 sets the note volume but does not cut the processing of notes.
MOD does not use note stops. There is no way to reset a channel or stop note-processing using the MOD format (except by stopping the song). The only workaround is to call an empty or silent sample, but the channel will remember the sample ID.

XM
Same as MOD, except that volume FX are accepted (vxx).
XM also uses Note Off (==), but is the same as setting v00 for samples (notes are still processed and the channel is NOT reset). If a volume envelope is used, Note Off uses the Fade amount while applying the envelope.
Also, using the Kxx command stops note processing and resets the channel, using the Fade amount to end the note BUT ONLY IF the Fade Out is completed. A side effect of this is that the note volume is remembered when the note is finished processing, and the next note called without an instrument will be processed with that volume until the volume has been reset or declared.

S3M
Same as MOD, except that vxx (volume effect) = Cxx, and SCx = ECx. Neither stops note processing.
Mxx sets the CHANNEL'S volume (all notes played after this call will be reduced by the % based on this).
Additionally, the Note Cut event (^^) stops the note processing AND resets the channel.

IT
Same as S3M. Note Off (==) is the same as that in XM, plus the addition of Note Fade (~~). Both of these note stops use the Fade amount on the sample (if applied as an instrument), except if a VOLUME envelope is applied to the instrument, in which case the sample continues to be processed (played) after a Note Off (==), applying its envelope(s). That is, Note Fade (~~) does not apply an envelope as the note is faded.

Saga Musix

QuoteWhen calling a note without a sample ID, the note is PROCESSED but not played. This means a timer is started for the channel as if the note were playing. Note processing continues until the sample playback reaches the end of the waveform (sample loops prevent this), or a new note, a note stop, or a channel reset is called in the channel. Calling a new note always resets note processing.
If a sample is called later (without the note) it will be applied to the note process, and if the sample has not been played to the end, it will pick up at that point.
Not sure what you mean here. Perhaps something like this?
ModPlug Tracker MPT
|C-5........
|...........
|...........
|...........
|...01......

The C-5 note is not processed there, unless the instrument column had an entry on a previous row.

In general, I would avoid SC0 / EC0, since I cannot guarantee it work properly (i.e. apply to mod "standards").  For example, handling of EC0 and ED0 is extremely weird in XM format, S3M is not quite as weird. Maybe you meant to write "ECx" in the MOD section?

QuoteNote Off (==) is the same as that in XM
Not quite. == only releases the envelope in IT format, i.e. Fade-Out is not applied. You are thinking too complicate here and your description might be too complicated for the average user. A more simple explanation would be:

Note Off (==) releases the instrument's sustained envelopes. If there is no envelope envelope present, this will fade out the instrument.

Fade-Out is obviously also applied when the end of the envelope is reached and the envelope loop is disabled, but that would actually go into a different chapter, namely the one about envelope handling.

So, basically, it's like this in IT format:
- == releases the sustained envelopes
- ~~ applies Fade-Out
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Harbinger

Excellent! Thanks for the corrections, Jojo! :wink:

One other thing:
The reason i say the note is "processed" even though no sample/instrument has been assigned is that i notice in my tests that sample playback picks up where it would have been had the sample been called (in the 2nd column) WITH the note. Put this in a pattern, play it, and go to the Sample tab to watch the sample playback:
C-5 .. .. ...
... .. .. ...
... 01 .. ...
... .. .. ...
= = .. .. ...

Try it in different formats with different note stop messages. This is what i based my finding on.

I also monitored the behavior on the various note stop commands, and noticed they're different for each module type. This needs to be described in the OHM...

Saga Musix

Right. Sorry, I was not working in compatibility mode, hence the instrument number did not trigger the sample...
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Harbinger

Well, i don't want to slide past that. Does "Compatibility mode" change these behaviors for all formats? How is this set? Or does MPT treat these tests differently based on whether a module is in "pure" format?

Saga Musix

I'm talking about the first of the "Miscellaneous Flags" in the song properties here. It only exists for IT and XM, S3M and MOD have it automatically set (i.e. it is the goal here to play the modules as accurate as possible in any case). If the flag is disabled, Modules are played as MPT 1.16 would play them, i.e. (almost) all modplug-specific bugs are "emulated". If the flag is enabled (which I wholeheartedly recommend, although it might break some modules which rely on mpt hacks), several effects are treated differently, i.e. the way IT and FT2 would play them. At the moment, this flag is disabled by default when creating a new IT/XM module. When loading a module that has not been written in MPT, the flag is enabled.

As an example, you know about the player abuse tests. Most of the tests that OpenMPT passes and MPT 1.16 doesn't are only passed in compatibility mode.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.