ModPlug Central

OpenMPT => Help and Questions => Topic started by: biolizardshadow on August 22, 2020, 21:15:54

Title: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 22, 2020, 21:15:54
Since not all MPTM commands are translated into MIDI effects when the module is exported as a MIDI file is it possible to add MIDI effects to samples and have the tracker act like its playing a MIDI instrument? This kind of functionality would be SUPER HELPFULL TO ME!
Title: Re: Is their a way add MIDI effects to samples?
Post by: LPChip on August 23, 2020, 10:35:45
Please keep in mind, OpenMPT is not a midi editor. It has functions to import and export midi, but they are only for your convenience, not to actually make midi music.

You should not export to midi. Create a module instead, or if midi is your final format, use other software.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 23, 2020, 18:16:52
I have no idea how you would "add a MIDI effect to a sample" but I believe the answer to whether it would be possible to add that is "no".
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 23, 2020, 19:57:08
Well my goal here is not to compose MIDI music but to compose music for various game consoles like GBA and NDS. OPENMPT is the software I use to emulate various sounds these systems make and MIDI is only really a tool that is used to export note data and turn that data into a set of instructions for these systems to read since the software's associated with importing the note data only accept MIDI files.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 23, 2020, 20:15:25
To better understand what you actually need and whether it's maybe already possible, it would be useful if you could describe what you think you need OpenMPT currently cannot export to MIDI that you require in the final file.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 24, 2020, 03:35:01
Well I was thinking maybe each channel could have an exclusive MIDI only effect area where you can only input MIDI commands and nothing else. I don't think that would interfere with normal effect commands and it might be a lot easier to program that in then it would be to make every module command compatible with the MIDI standard upon exporting it as a MIDI file.

Basically what I'm looking for is a way to emulate Panning, Channel Volume and some other effects without having to add them later cause they don't export to a MIDI file.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 24, 2020, 11:29:04
Are you aware that MIDI macros (https://wiki.openmpt.org/Manual:_Macro_Configuration) exist and are exported to MIDI files?
You may also want to look into plugin volume command handling (https://wiki.openmpt.org/Manual:_Instruments#Plugin_.2F_MIDI), but in order to be able to use that, instruments already need to be assigned to a plugin (e.g. the MIDI I/O plugin) before export.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 24, 2020, 13:14:16
I am aware that those macros exist however they only work on MIDI instruments not samples so if I were to use MIDI panning effect I would have no way to tell where I'm panning to exactly that's what I'm talking about. That's why I wanted to know if you could add MIDI effects to samples that would work in the tracker.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 24, 2020, 13:20:48
You can use the u/v/x/y macro letters to use the current panning and volume settings. That way you can hear the panning in the tracker and also export it as a MIDI command at the same time.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 24, 2020, 16:33:45
I'm a bit confused here are you saying something line X3C would export to a MIDI file cause whenever i use an X command it doesn't export to the MIDI file.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 24, 2020, 16:36:37
View -> Zxx Macro configuration brings up the The macro configuration dialog (https://wiki.openmpt.org/Manual:_Macro_Configuration), where you can freely edit all the macros.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 24, 2020, 16:44:48
How do I change it?  It changes to custom when I try changing the letter at the end.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 24, 2020, 16:57:35
Is their a video or something that can explain how to use macros cause I'm really confused here.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 24, 2020, 17:34:07
It would be helpful to explain what you are confused with.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 25, 2020, 01:29:52
I'm on the screen with the Zxx macro effects and that's where I'm stuck since I don't know what to do from this point onward. Also will this work on channels playing sampled instruments or just VST/VSTI instrument plugins?
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 25, 2020, 11:02:57
Here's what I would suggest to do:
1. Pick an empty fixed macro at the bottom of the dialog (e.g. ZFF)
2. Set its value to Bc0Ay - this will send MIDI CC 10 using the current channel panning (B = MIDI CC, c = current MIDI channel, 0A = CC 10, y = current panning value)
3. Use this macro (ZFF) in the pattern where you want to update MIDI panning.
4. Repeat these steps for any other MIDI message you might want to send. Please refer to the macro syntax in the manual to do that. Note that you can put more than one MIDI message in a single macro, e.g. "Bc0Ay Bc07u" would update both MIDI channel panning and channel volume at the same time.

QuoteAlso will this work on channels playing sampled instruments or just VST/VSTI instrument plugins?
These macros will not do anything audible on sample channels while editing, but they will work as expected when exporting to MIDI.

I have attached an example which should hopefully illustrate the example above. You will also see the difference between Zxx and \xx in the example - Zxx sends a MIDI message once a row, while \xx sends one on every tick.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 25, 2020, 14:34:14
Oh now I see what you mean so the ending letters at the end of the macro determine how the macro behaves?. The example you provided was good and helped me understand how some of this stuff works now.




Thank you very much for your help!
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 25, 2020, 14:48:00
Also is there a way to export vibrato command as the MIDI modulation command? Theirs an h vibrato command in the volume effects but it doesn't seem to do anything.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 25, 2020, 16:09:47
Quote from: biolizardshadow on August 25, 2020, 14:34:14
Oh now I see what you mean so the ending letters at the end of the macro determine how the macro behaves?
Well, macros are like a mini programming langauge. Each letter has a meaning as documented in the wiki.

QuoteTheirs an h vibrato command in the volume effects but it doesn't seem to do anything
Vibrato commands are exported as pitch bend commands. By default, OpenMPT sets a pitch bend depth of 12 semitones for each sample-based instrument.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 25, 2020, 17:04:44
Then how would you go about creating a custom macro and knowing what does?
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 25, 2020, 17:14:53
Macros are nothing but raw MIDI messages (https://web.archive.org/web/20130110054709fw_/http://home.roadrunner.com/~jgglatt/tech/midispec/messages.htm). They work the same way as MIDI messages work in any other application, with the addition that you can replace any part of the macro with variables that change their value based on the Zxx parameter / volume / panning / etc.
You don't need to remember all types of MIDI messages by heart, you can generate them from the "Type" dropdown menu in the macro editor. For example you could choose "MIDI CC", then choose "CC 10" from that dropdown and you would get "Bc0Az", which would send MIDI CC 10 with a parameter based on the Zxx parameter. All you need to do then to reach the macro from my example above is replace the z by y so that it insert the current channel panning instead of the Zxx parameter into the message. Similarly, "c" is replaced by the current MIDI channel. You could replace "c" with "0" if you always knew that your message should be sent on the first MIDI channel, for example.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 26, 2020, 03:45:55
I was talking about maybe something not used by general MIDI, kind of like a system exclusive event. Also is their a way to activate two macros at the same time within the current channel?
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 26, 2020, 10:35:29
QuoteI was talking about maybe something not used by general MIDI, kind of like a system exclusive event.
You mean as an alternative way to write out vibrato events?

QuoteAlso is their a way to activate two macros at the same time within the current channel?
No, you can only activate one macro at a time, but as shown in the example file above you can put multiple MIDI messages into a single macro, as long as they don't need different values for the "z" parameter.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 26, 2020, 15:28:49
The example file only has one MIDI message. And when I was asking about writing custom MIDI messages I was just intrigued by the posabilities that are out there with custom MIDI messages.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 26, 2020, 15:32:50
No, the macro I configured for "ZFF" has two MIDI messages: "Bc0Ay Bc07u" that's MIDI CC (channel panning) followed by MIDI CC 7 (channel volume).
And yes, you can write any custom MIDI message you want. It doesn't have to be a MIDI CC, it could be a SysEx message too. As long as you know how the SysEx message has to look like, and as long as it's shorter than 31 characters, anything is possible.
Title: Re: Is their a way add MIDI effects to samples?
Post by: biolizardshadow on August 27, 2020, 01:22:49
Quote from: Saga Musix on August 26, 2020, 15:32:50
No, the macro I configured for "ZFF" has two MIDI messages: "Bc0Ay Bc07u" that's MIDI CC (channel panning) followed by MIDI CC 7 (channel volume).
And yes, you can write any custom MIDI message you want. It doesn't have to be a MIDI CC, it could be a SysEx message too. As long as you know how the SysEx message has to look like, and as long as it's shorter than 31 characters, anything is possible.


Hmm for some reason its only showing the set filter cutoff as the only macro running, but it still exports the MIDI messages when I run it through a MIDI editor.
Title: Re: Is their a way add MIDI effects to samples?
Post by: Saga Musix on August 27, 2020, 09:54:24
As I previously explained, I picked macro ZFF for sending the MIDI messages. You can find it at the bottom of the dialog in the dropdown list that by default starts at Z80. Z80-ZFF are fixed macros, i.e. they cannot use the letter "z" in the macro to depend on the Zxx parameter. At the top of the dialog are parametered macros instead, where a single macro covers the range Z00-Z7F, and the Zxx parameter is inserted into the maro via the letter z. For example in the default macro (F0F000z), if you call Z33, it will turn the macro into F0F00033. But since these macros I picked as an example don't depend on the letter "z", it doesn't make sense to use them in a parameter macro, so I put them in an unused fixed macro instead.