Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send MIDI message Target #6

Closed
DLongoni opened this issue Jul 22, 2020 · 12 comments
Closed

Send MIDI message Target #6

DLongoni opened this issue Jul 22, 2020 · 12 comments
Labels
enhancement New feature or request high priority realearn Related to ReaLearn

Comments

@DLongoni
Copy link

Another target that would be useful IMO is to send a custom midi message to the device. This is especially useful in conjunction with the possibility to select the same source CC for multiple mappings. So let's say you want a button to do something when pressed, and also turn off another button. My use case would still be the "Select region": I have 8 buttons, I want the current region button to be lit, and that only. This can either be achieved by using a custom "Play region" trigger, or by using a custom action in conjunction with another "turn the other lights off" midi message.

I hope I made myself clear. Then again one may then extend it to a generic midi message, not only a CC... But this may be too complicated..

Thanks!

@helgoboss
Copy link
Owner

helgoboss commented Jul 22, 2020

If I understood you correctly, this sounds more like a temporary workaround until a proper "Play region" target is implemented. A "Turning off the other button" mapping shouldn't be necessary with a well-written target because ReaLearn's feedback logic should take care of that.

What I would find interesting is to have a "Send MIDI message to FX" target. This would allow controlling FX parameters that are accessible via MIDI only.

@DLongoni
Copy link
Author

Yes, this idea is motivated by the same use case as the "play region" and it would be a workaround indeed. Formerly I though this could be a workaround for a few other use cases, but maybe I am just wrong and leaving midi messages to the user could only cause a lot of problems... All the use cases I am thinking about should only be solved implementing a specific target, and its relative feedback.

As for the "Send MIDI message to FX" do you mean to an actual external midi FX device, or to a plugin/VST?

Thanks for clarifying, maybe this should be closed due to this discussion.

@helgoboss
Copy link
Owner

I mean sending a MIDI message to a plug-in/VST. But I guess sending it to an external MIDI device would make sense as well.

@helgoboss helgoboss added the enhancement New feature or request label Aug 9, 2020
@jackmau
Copy link

jackmau commented Oct 7, 2020

if I can add a note, my current workaround to send midi messages to an external device is to use realearn to control a ReaControlMidi instance and select the CC (only 5) from there. Note this won't be useful in @DLongoni scenario, as this messages could only be send to FX and external devices, not to trigger actions

@DLongoni
Copy link
Author

DLongoni commented Oct 7, 2020

@jackmau thanks a lot for the hint! I have to do some work on this, but it may very well be a workaround also for my case! I'll keep you posted

@chords-chords
Copy link

@jackmau thank you for the tip from me as well!

I've been trying these last few days to get ReaLearn to send MIDI messages to change the color of my grid controller's buttons by sending specific MIDI messages which the controller accepts as "color-change messages". I want to know which buttons are actually mapped. They can even have different colors assigned which is of course quite useful.

I've been experimenting with ReaControlMIDI the way you suggested for the last few hours and it seems this is currently the best workaround for my goal.

@jackmau
Copy link

jackmau commented Oct 12, 2020

@jackmau thanks a lot for the hint! I have to do some work on this, but it may very well be a workaround also for my case! I'll keep you posted

Actually if you want to trigger an action there is a convoluted but possible way of doing it (I did test it and it worked in the past): you need to set up a virtual midi bus (you can do it natively on Mac OS X in the midi studio or easily on Windows using loopmidi or something similar) and output your midi message to the bus as hardware midi out on the track you have Reacontrolmidi and then activate the midi bus for control input on reaper midi preferences and voila': you can use messages from reaper to trigger reaper actions

@jackmau
Copy link

jackmau commented Oct 12, 2020

@jackmau thank you for the tip from me as well!

I've been trying these last few days to get ReaLearn to send MIDI messages to change the color of my grid controller's buttons by sending specific MIDI messages which the controller accepts as "color-change messages". I want to know which buttons are actually mapped. They can even have different colors assigned which is of course quite useful.

I've been experimenting with ReaControlMIDI the way you suggested for the last few hours and it seems this is currently the best workaround for my goal.

tbh since conditional activation has been added there is much better way to do what you wish directly in realearn, you know you can set up feedback only assignments, right? Now you can also activate those assignments conditionally on a realearn parameter. You can easily activate a parameter with a normal control assignment. If you need complex feedback (because different messages activate different colours on your controller) you can use EEL feedback formulas, conditional activation allows for formula as well. In order for this to work you must have selected your midi controller as feedback target, ofc.

In practice suppose you have 8 buttons which transmit and lit on different midi messages and you want to lit one button a time when it is pressed and have all the other buttons lite off. You can map the 8 buttons to control parameter 1 on your realearn instance from 1 to 8, unfortunately you can't (yet? @helgoboss can confirm if this is still in the pipeline) use the parameter in the EEL feedback formula., but you can create conditional activation feedback only assignment where the source is actual the target CC which activates/deactivates color light. You will have to create 16 assignment (2 per each button, one that turns it on and one that turns it off). The assignment that turns on the light on your controller will be activated when parameter 1 is equal to the button you just pressed, the other one, conversely, would have to be activated when the button is not pressed (p1 != X on conditional activation EEL formula)

@chords-chords
Copy link

chords-chords commented Oct 13, 2020

@jackmau, I understand what you're trying to say but your example makes no sense to me. I tried doing it the way you suggested today but I completely failed in getting any feedback messages sent out.

I have a grid controller with 64 buttons (actually it's a layout in the TouchOSC mobile app on my iPad). Each button sends out a MIDI note message on channel 1 with values ranging from 36 to 99. The controller responds great to ReaLearn's feedback and these buttons light up when pressed (the toggle action also works fine).

Here's exactly what I want to achieve: For example I want to map certain Reaper actions to the first 8 buttons (MIDI note messages from 36-43 on channel 1) and I want to make 2 sets (programs) of such mappings. The last two buttons in my controller (MIDI note messages 98 and 99) would act as program "switch" buttons (by using the "When program selected" conditional activation). This is no problem. The problem lies in the following: I also want to change collors for these 8 buttons when one of the "switches" is pressed. When I press the first switch I want the first 8 buttons to color green for example and when I press the second one I want them to color red. In order to change the color of an individual button I have to send different MIDI messages to the device than those which are sent out by it (receiving the same messages wouldn't make much sense). I can choose the MIDI messages but the value range is restricted from 0-8 (one integer for each of the available colors). At the moment I have it set up as this: Each button accepts CC36-99 MIDI messages on channel 16. That means I have to somehow map my 1st "switch" in ReaLearn to also send CC36-C43 with a value of 1 (the integer which corresponds to the green color) on channel 16 and the second one to send the same messages on the same channel with a value of 0 (correponds to the red color).

I don't really see how feedback only mappings work with this (I tried messing with your suggestions but I didn't succeed). I don't see how I can set up a feedback only mapping and then actually get it to send out the desired CC message. Let's put it this way: I don't actually know how to set up a feedback only mapping and how it works even though I tried. I set my desired MIDI message as its source but what do I set as its target? Nothing? How does a feedback only mapping actually send the MIDI message which is set as its source when nothing can actually trigger it? You wrote: "Now you can also activate those assignments conditionally on a realearn parameter. You can easily activate a parameter with a normal control assignment.". Yes, I can control a parameter but as far as I know that parameter change alone doesn't actually send out a message from my second (feedback only) mapping which depends on this parameter. That feedback only mapping just becomes active and nothing actually happens. That's what I experienced in today's experiments with this suggestion.

What am I missing here? Forgive me for my rambling but it comes from my sincere attempt to understand your suggestion and from a complete failure to succeed (and to understand too) :)

The ReaControlMIDI workaround seems much more straightforward and simple to understand but I do want to try your suggestion if it's actually possible. Any other tips are most welcome :)

@jackmau
Copy link

jackmau commented Oct 14, 2020

@chords-chords you are right, I wasn't enough clear in my answer. A feedback-only assignment would still need a target and would only change when the target change. For our use case the target of the feedback-only assignment would have to be your parameter which stores the state you are currently in. So that every time the parameter value changes, because you pressed a switch, he will send feedback. You can easily set source limitation so that it outputs just the midi messages that activates the colours you need.
Always remember that everything going on in a realearn assignment is normalised to source and target constrains: if you set source between 1 and 2 and target (your parameter) between 0 and 1 you will get a feedback of 1 when parameter= 0 and a feedback of 2 when parameter = 1. Note that, very confusingly, as referred in #43 , there is a mismatch of 1 between the parameter value you see in the conditional activation (when program selected) and the one you see as target (a target of 0-1 as described correspond to an program selected of 1-2).

One question though, if you have just 2 states, why using 2 buttons and not just toggling on one? You can achieve toggling behaviour easily even if the controller doesn't allow for it by writing a custom EEL control dependent on the current value of y, literally: y = (y==0) ? 1 : 0, if you are just toggling between two states (provided you defined the desired target limits for the parameter you want to control). Also note that in my previous answer I was referring to amore complex setup of interdipendent buttons, in your case you are fine with just one feedback mapping per button which can easily manage both colours as previously described.

@chords-chords
Copy link

@jackmau, thank you so much!

I understand everything in this answer and was also able to reproduce everything you suggested in ReaLearn. Works as a charm. I'll just have to expand on that knowledge now. The way you described the functioning of a feedback-only assignment (responding to a change of the parameter which is set as its target) immediatelly made sense. This normalisation bussiness however (and applying EEL formulas) is something that I still have to wrap my head around. I do understand the concept (and I do understand the EEL equations) but in a practical example I have trouble coming up with these solutions by myself - I guess that I'm still not familiar enough with all of this.

Regarding your question: I do plan to make more than 2 sets of mappings in time and that is why I was contemplating using 2 buttons (or more). Today I tried it that way first but I was unable to get the switch buttons to light up (not change colors) interchangably (to show which mapping was active) which is also something that I wanted but it's something I'll eventually figure out on my own. So I scrapped that idea for the sake of trying out your suggestion and it really worked.

Anyway, thank you once more for taking the time to help me out.

@helgoboss
Copy link
Owner

Implemented. Can be sent to ReaLearn's FX output or an arbitrary MIDI device.

Sending to a specific FX (which is not in the same FX chain) is not possible at the moment due to REAPER API limitations.

@helgoboss helgoboss added the realearn Related to ReaLearn label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority realearn Related to ReaLearn
Projects
None yet
Development

No branches or pull requests

4 participants