ModPlug Central

OpenMPT => Help and Questions => Topic started by: RG (aka AUDIOMONSTER) on March 18, 2013, 20:32:27

Title: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 20:32:27
Hi everyone


Just asking myself a silly question (I'm sure there'll be a simple answer ;-)):

How to send program changes instructions to a bank in a sampler like Kontakt or other, USING A MACRO IN A PATTERN ?

Indeed, when you change "MIDI Program" number in the "Instruments" section, and then play a note with the current instrument, the program change works perfectly in the midi sampler where the midi even is sent. (Kontakt Bank)

So it is for sure possible, but what would be the MIDI macro to use for, in a sequence ? (the goal is to get equivalent to sort of Keyswitch between articulations, each articulation beeing a program in a bank file)


Untill now, to change program number in a Kontakt Bank, I used as much Openmpt instruments as programs in a bank, with each Openmpt instrument on the same midi channel, but with a different "Program number".


I suppose it will be sort of S.. and Z... macro ? But which exactly ?

Any idea ?


Thanks a lot ;-)
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 18, 2013, 20:37:48
Yep, this is indeed quite easy to accomplish.
Create a parametered macro (http://wiki.openmpt.org/Manual:_Macro_Configuration#Parametered_Macros) "Ccz" (Note that the first C must be upper-case, the second c lower-case!), then activate this macro on some channel on which the plugin is used using Zxx - Z00 would send a program change for the first instrument, Z01 for the second instrument, and so on. That way, you can access the first 128 programs (Z00...Z7F).
If you also need to switch the bank, you will require an additional Bank Select macro - to accomplish that, choose "MIDI CC" from the "type" dropdown list of some macro slot and select CC 32 - Bank Select [Fine]. Bank select must be immediately sent before program select.
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 20:39:15
Fantastic, thanks a lot for your quick answer ! I'll try this ;-)

Best regards !
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 20:52:40
OK just to be sure I got it well :

I go to the Zxx Macro configurations, I choose a new SF... macro number (like, here, 14 (SFE)), I select "Custom" type, then input "Ccz" in the "value" case ?

And then I can call it in my sequence by SF9 then Z..., like all other Z macros ? (that's what I just did but without any success ;-))
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 18, 2013, 20:56:25
I hope you meant SFE in both cases. ;) Yes, it should work that way. Note that the macro must be placed on a channel that is used by the plugin (either by playing some notes there or by assigning the plugin as a channel plugin).
I've added an example module as an attachment so you can verify that you're doing everything like I do. I'm using Synth1 as an example plugin but it should work with any other synthesizer as well.
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 21:02:21
Indeed, it perfectly works in your module, I'm gonna try to figure out why it doesn't in Kontakt.

Thanks again for your time, really appreciate ;-)

Best regards
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 21:45:41
Really weird...

Program changes work with Kontakt when changing the "MIDI Program number" in "Instruments" sections, as I have said before, but not at all with macro, in a sequence...

I also tried other vsti, and same problem...

However, I noticed that the "Synth1" plugin you are using is a bit special : it has a "Receive program change" and "Receive bank select" option to enable or not, in the "option" menu.

When it is not selected, program changes won't work in the sequence...

And most of other Vsti plugins does not have such "enable or not" option, and show their programs list in the "presets" list ("Synth1" doesn't neither)...

Have you tried it with other Vsti ?
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 18, 2013, 21:52:13
Yes, I've tried the example module with several synths and they all had no problems with program changes. After all, OpenMPT sends the very same program change message when you specify the MIDI program number on the instrument tab - it is sent directly before sending a note. This is just a wild guess, but here's something you can try: Assign your Kontakt instance to a channel that is left of the channel on which you are playing notes. Then move all Zxx effects to that channel. This way, it should be guaranteed that the program change messages are sent directly before any note events. Maybe this will help.
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 18, 2013, 21:57:37
Quote from: Saga Musix on March 18, 2013, 21:52:13
Yes, I've tried the example module with several synths and they all had no problems with program changes.
In fact, the only plugin that I had problems with so far was the Korg M1, it stays completely silent in that example module because loading a patch seems to take a while (and during that loading process, new notes are apparently being dropped). But that also happens when using multiple instruments with different MIDI program assignments, so it's not specific to the Zxx method. Can you confirm that using multiple instruments with different MIDI programs work as intended with Kontakt?
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 22:04:52
Absolutely ! I'm just doing it, right now ;-)
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 22:06:20
(I even can visually see the real-time changing in the Kontakt bank, when swapping from an instrument to another)
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 18, 2013, 22:09:05
Ok, this is really weird. Just to rule out yet another possible point of failure, are you running OpenMPT 1.20 or later? Versions older than OpenMPT 1.20 would not interpret the "Ccz" macro correctly. Did you try placing the Zxx macros on a channel left of all notes as I have suggested? Are the Zxx macros placed on the same row as notes, or are they on rows between two notes?
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 22:10:54
To all your questions : yes ;-) (I always use a specific channel for Z macros, for more clarity) and indeed, I'm using the latest version of OpenMPT ;-)
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 22:17:50
(Obviously, Openmpt does NOT send the same MIDI message when using the program change Z macro in a sequence, than the one it send in "Instruments" section, when you press a note key after having changed "MIDI Program number")...
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 18, 2013, 22:30:03
I'm a bit puzzled then. I guess I need a bit more time to think about this. One more question... are you working on MIDI channel 0 (first channel)? If not, try using channel 0 instead and see if that changes anything.
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 22:36:44
Yes, I've even tried all possible midi channels...
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 18, 2013, 23:59:47
Wow, I think I've solved the problem : it perfectly works...in ".mptm" format !

And I'm still only working in ".it" format ! And it doesn't, in this format...

So, I think I have to change ;-)

By the way, what is the difference between those two formats ?
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 19, 2013, 00:04:21
That's really weird, as I'm not aware of any differences in Zxx handling between IT and MPTM (and my example with Synth1 also works with IT files). But glad to hear that it works now.
I just downloaded Kontakt 5 Player to check if I could reproduce the problem, but I don't even know how I could make use of program change commands with the provided demo instruments... Can you explain how to set Kontakt up to respond to program change messages? Maybe it will also work in the Player... Then I could check out what went wrong in the IT handling.

To answer your last question, there are not many differences, but MPTM has a few extra features not preset in the (already raped) IT format, such as Parameter Control Events (http://wiki.openmpt.org/Manual:_Parameter_Control_Events), which are really useful when working with plugins.
If you prefer to work with the MPTM format from now on, there is a (currently) hidden setting (http://wiki.openmpt.org/Manual:_Hidden_Settings#.5BMisc.5D) (DefaultModType) in the INI file to make OpenMPT create MPTM files by default instead of IT files.
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 19, 2013, 00:13:45
Thanks for the infos and tips ;-)

I don't think Kontakt needs any setting to respond to program changes : juste create a "bank" instrument, then load several Kontakt instruments at different program numbers (1 to 127) of the created bank, and then it is ready to receive the program changes ;-) (that is how I do)
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 19, 2013, 00:28:13
That's where the problem starts, I don't know how to create such an instrument. :) I can double-click the rack space to insert some kind of empty instrument, but I don't know how to add any instruments to that or if that's even what I want.
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 19, 2013, 00:35:48
In "Kontakt" : - File/New instrument bank

Then, you can see the bank...Click on the toolkey on the upper left of the created bank, to expand it...

Then you can see all the program numbers : just drag and drop any Kontakt instrument into any program number...

Done ;-)
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 19, 2013, 00:41:06
Ah, thanks. Weird, for me this works in both the IT and MPTM format without any hassle! Can you try converting the MPTM file back to IT and see if it still works for you as well? I'm curious now...
Title: Re: MIDI Program Change by pattern effect
Post by: Saga Musix on March 19, 2013, 00:46:45
I think I do see a difference between using program changes through instruments and using macros now. All Zxx macros on a row are evaluated after the note data has been sent, meaning that there is no way to apply instrument changes using macros before sending a note on the same row. Some plugins seem to care about that (like Kontakt), some others don't (Synth1). I'm afraid there's not much that can be done about this right now, due to how the code is structured. In essence this means: For Kontakt, program change macros must be put on the row before the note for which they should be applied.
Title: Re: MIDI Program Change by pattern effect
Post by: RG (aka AUDIOMONSTER) on March 19, 2013, 00:52:53
Oh yes, I was aware of this (Z macros to be put BEFORE the note) but the problem was still remaining...

Anyway, that is no more a problem : I'll just pass to .mptm ;-)