Filter Modes & Cutoff with macros

Started by Harbinger, March 08, 2011, 17:45:25

Previous topic - Next topic

Harbinger

One thing not fully explained in the OHM is the use of Zxx macros for filtering sample-based instruments. For those new to tracking with MPT, let me clarify after some testing...

When creating a sample-based instrument in the Instruments tab, you have the option to set the instrument's default cutoff and filter mode. For example, you can take a sample, set its mode to Hi-Pass (the default is always Lo-Pass). You can then adjust the cutoff range to "shelf" the sound to that side if you check the box next to the cutoff option.

Take a piano sample. If you set the mode to HP, and set the cutoff to the lowest setting (for MPT it's 130 Hz -- a bass even lower than most kick drums), the HP shelf will extend all the way from the highest frequencies down to the lowest). Move the cutoff slider to the right, and you'll notice more of the lower frequencies are "cut off" (hence the term). At its highest setting, only the highest frequencies are left, making the piano sound tinny and thin. The opposite is true if you set the mode to Lo-Pass -- the higher frequencies are cut off as you move the slider LEFT. You'll only hear the bassest notes in the piano sound if those frequencies lie BELOW the cutoff range (remember, that 440 Hz for example is middle A). Actually the cutoff shelf is not sharp it's smooth -- altho an option for that would be nice. The graphic below is in the OHM to remind you of the various values and their effect on each frequency range.

It helps to imagine that each box in the image is a set of Equalizer sliders that filter out various frequencies.
The top pair of boxes is the shelf effect you get when you set the Filter Mode, but not the Cutoff frequency. The other pairs of boxes show the effect of different settings based on Filter Mode (Lo-Pass or Hi-Pass) and the extremes in Cutoff values and Resonance values.

You can alter both the mode and the cutoff range using SFx assignments and Zxx commands for modifying a sample's audio during playback. SF0 is MPT's default assignment, and its designated for the Filter Cutoff. You can assign SF1 to the Filter Mode in the Macro Manager dialog (accessible from the Patterns page), but the values to use have never been made clear. The range for the Cutoff slider is from Z00 to Z7F. The Filter Mode is set to Lo-Pass at Z00 (up to Z0F), and Hi-Pass at Z10 (or higher).
In order to extract only the highest frequencies of a sample, set the Filter Cutoff (default: SF0) to about 1760 Hz or higher, after setting the Filter Mode to Hi-Pass, like this:

... ..  .. SF1        You've already assigned to Filter Mode in the Macro Manager
... ..  .. Z10        Same as setting the Filter Mode in the Instruments page to Hi-Pass
... ..  .. SF0        Default setting for Filter Cutoff
C-5 01  .. ZC0        Same as setting the Filter Cutoff to approx. 1760 Hz.in the Instruments page

If you want to use the Lo-Pass Mode, set the value in the second row to Z00. Then all notes whose frequencies are ABOVE ZC0 (about 1760 Hz) will be cutoff in this example.
Of course you can interpolate cutoff values to create a frequency shift for any note, a technique esp. useful in today's music.

ONE IMPORTANT CAVEAT: Calling a note event (note and/or instrument) WITHOUT a Zxx command resets the filter to the instrument's default settings. Therefore, the note event must be called at the first Zxx command AFTER the SFx command for the Cutoff. In the above example, if C-5 (with or without the instrument) was called in the row AFTER the ZC0 command was passed, the ZC0 cutoff value would not have been applied to the note, instead reverting back to the instrument's assignment found in the Instruments page. (The ZC0 would still have been processed on any notes still playing in the channel.)

Keep in mind that when these commands are encountered in playback, the changes to these settings are not reflected in the Instruments page, in case you're trying to monitor the settings. (The Instruments page will always show the instrument's default settings, no matter what is changed during playback.)

Don't forget that you can also use a higher frequency range by setting the Extended Filter Range checkbox in the Song Properties dialog. This allows your maximum cutoff to extend up to about 10,000 Hz rather than MPT's default 5,000 Hz. (The Zxx range is still set from Z00 to Z7F, but is translated for the new frequency range.)

The information in this thread will find its way into the next build of the OHM, but this is placed here for reference in case questions arise before then. If anyone else learns more info on this subject, please include it in this thread (even as MPT evolves).

Saga Musix

#1
Instead of using parametered macros (i.e. Z00-Z7F) for filter mode and thus having to switch between macros constantly, it is actually a better idea to use the "Z80-Z9F controls resonance+mode" preset for the fixed macros. You can then use Z80-Z8F for controlling the filter's resonance as always, and use Z90/Z91 for setting the lowpass filter, and Z92/Z93 for enabling the highpass filter. Or, if you really need the full resonance spectrum (Z80-ZFF), just exchange two of the fixed macros by the lowpass / highpass macro.

QuoteActually the cutoff shelf is not sharp it's smooth -- altho an option for that would be nice.
Yes that would be nice, but as far as I can tell it's not possible with the filter type used.
» 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

Good to know. I still don't know how all those macro settings work, and will need to know now that we're using more samples and fewer VSTi's in our sound generation. Plus, since newcomers should be starting off manipulating samples as they learn MPT, the more macro info i can supply, the better. Thanks, Jojo...

Harbinger

While writing up more details in the OHM on using Filtering macros for samples, i came across a couple of questions, the first brought up in your last post, Jojo:

Quote from: Jojoif you really need the full resonance spectrum (Z80-ZFF), just exchange two of the fixed macros by the lowpass / highpass macro.

1. Not sure what you meant here. Suppose i DID need the full use of Z80-ZFF for resonance control. Can i use the same SFx assignment for switching between LP and HP (which was the point of your post)? How?

2. The first Fixed Macro allows you to control Resonance with Zxx values between Z80 - Z8F. Why is this here, when you can use the next menu option (Z80 - ZFF) to do essentially the same thing with presumably more detail? Is this only for backward compatibility or for compatibility with other trackers?

Saga Musix

QuoteNot sure what you meant here. Suppose i DID need the full use of Z80-ZFF for resonance control. Can i use the same SFx assignment for switching between LP and HP (which was the point of your post)? How?
No, but you'd have to spare two Zxx values for the filter modes, f.e. Z81 and Z82. The rest could be used for resonance.

QuoteThe first Fixed Macro allows you to control Resonance with Zxx values between Z80 - Z8F. Why is this here, when you can use the next menu option (Z80 - ZFF) to do essentially the same thing with presumably more detail? Is this only for backward compatibility or for compatibility with other trackers?
It's Impulse Tracker's default macro setting. This one is automatically assumed if no macro information is present in a loaded IT/MPTM file.
» 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

Quote from: Jojo on March 22, 2011, 21:09:01
QuoteNot sure what you meant here. Suppose i DID need the full use of Z80-ZFF for resonance control. Can i use the same SFx assignment for switching between LP and HP (which was the point of your post)? How?
No, but you'd have to spare two Zxx values for the filter modes, f.e. Z81 and Z82. The rest could be used for resonance.

How is this achieved? I don't remember seeing that setting. Tell me exactly what has to be set in the Macro Manager dialog so i can learn.

QuoteThe first Fixed Macro allows you to control Resonance with Zxx values between Z80 - Z8F. Why is this here, when you can use the next menu option (Z80 - ZFF) to do essentially the same thing with presumably more detail? Is this only for backward compatibility or for compatibility with other trackers?
It's Impulse Tracker's default macro setting. This one is automatically assumed if no macro information is present in a loaded IT/MPTM file.[/quote]

Gotcha. Tracker compatibility.

Saga Musix

Quote from: Harbinger on March 22, 2011, 21:25:37
How is this achieved? I don't remember seeing that setting. Tell me exactly what has to be set in the Macro Manager dialog so i can learn.
Step 1: Memorize macros for setting the filter mode (that would be F0F00200 for lowpass and F0F00210 for hipass).
Step 2: Choose preset type "Z80-ZFF controls resonance".
Step 3: Choose Z81 (or any other value that you would like to replace) from the dropdown box and enter F0F00200 next to it.
Step 4: Choose Z82 (or any other value that you would like to replace) from the dropdown box and enter F0F00210 next to it.
Step 5: Click "Set as default" if you want this setting to be used for all newly created modules (i.e. this is not used when loading a module that has no macros embedded)
Step 6: ? ? ? ?
Step 7: Profit
Step 8: There is no 8th step.
» 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

THan-Q!

So that's what that little Custom box is for! As usual, i learn more with your response than i thought there was to be known! ;D

By the way, are there more hex codes for other macro settings that would be useful? (I didn't even know about these two for lo-pass and hi-pass)...

Saga Musix

Well...
OpenMPT has some internal "devices", which are the cutoff, resonance and filter mode control, plugin dry/wet ratio and parameter automation. Those can be controlled using Zxx and \xx. There are no further "secret" hex codes I'm aware of.
Everything else (including MIDI CCs) is an "external device", that means that it is not interpreted by OpenMPT itself, but it sent straight to the plugins. Those external devices can be controlled using Zxx and \xx, however \xx will work exactly like Zxx in this case (i.e., no interpolation is applied).
If you have a brief look at MIDI.TXT which came with Impulse Tracker, you will notice that there are some things which are currently not possible with OpenMPT - for example using the letter "n" in a macro, which should send the value of the note which is next to a Zxx or \xx to the plugin. I will try to get this stuff to work. It would allow for some really awesome effects, for example note-controlled cutoff and resonance!
» 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

'kay!

Thanks for staying on top of it.  8)