Announcement

Collapse
No announcement yet.

MIDI message variable min or max value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MIDI message variable min or max value

    Hi Everybody,

    I want to create a MIDI message by pushing a button, but when released, returns to it's original value. I've been able to create a button that sends a min value and a max value, but I want the min value to adjust to whatever the setting is in it's current state, rather than a set min value.
    Ex. A filter cutoff parameter in a plugin is attached to a MIDI CC slider which I actively adjust. A MIDI CC button when pressed sets the filter cutoff to 100, but when released returns to the last position the other MIDI slider was set to.

    Any way to do this?

    Thanks,

    Jason

  • #2
    Hi Jason,

    Here's a suggestion:
    1. use a variable to store the latest filter cutoff value you sent.
    2. when the button is released, trigger a OSC event that will send the default MIDI value, and set the fader back to the correct position.

    I'd like to give you step by step details, what are you using to send OSC messages to OSCulator?


    Cam


    PS: if you search for "fader reset" in the forum there are a few threads that might be of interest to you, see:

    Comment


    • #3
      Originally posted by camille View Post
      Hi Jason,

      Here's a suggestion:
      1. use a variable to store the latest filter cutoff value you sent.
      2. when the button is released, trigger a OSC event that will send the default MIDI value, and set the fader back to the correct position.

      I'd like to give you step by step details, what are you using to send OSC messages to OSCulator?


      Cam


      PS: if you search for "fader reset" in the forum there are a few threads that might be of interest to you, see:
      http://www.osculator.net/forum/searc...earchid=125057

      Thanks for the quick reply Cam. I'm using Touch OSC on my iPad with OSCulator to control various plugins in Live. I'm not very skilled at understanding OSC messages, but I do understand MIDI, so I was just doing that until I could get a grasp on how to program using OSC messages. For instance, I don't know how to create a variable I can use to store the latest cutoff value and trigger an OSC message with a button release to send a default MIDI value. I understand the concept, but I'm in the very early learning stages of Osculator. Any help at all would be appreciated. In the meantime I'll check out the link you send and see if it answers any of my questions.


      Thanks so much!

      Jason

      Comment


      • #4
        Hi Jason,

        This is a pretty advanced topic, let's hope I will explain myself clearly enough.
        So have the basic idea in my previous post.

        As I always, I used the layout Beatmachine for the purpose of the example.

        When you hold you phone horizontally, the left yellow fader controls the cutoff on MIDI CC 10, and bottom left purple button when pressed sends MIDI CC 10 at value 100 and sets the fader at 0.78 (100/127). When you release the button, it sends the previously saved MIDI value and sets the fader back to its original position.

        As you can notice, when pressing and releasing the button we both send a MIDI value, and set the fader position. After all, we could use the same processing when we move the fader: we need to send a value, sending back the current position wouldn't hurt. Therefore, we want to have a custom OSC message that does those two actions, and OSCulator will call this OSC message when the button is pressed or released, and the fader moved. This is exactly like a function if you think about programming languages. Also, this is a good thing because the MIDI CC number for the cutoff mapping is defined at only one place.

        You will notice that this pattern is used in several other example I gave on this forum.
        1. So, first of all, register the fader /1/fader1 in OSCulator, and duplicate it by pressing Command-D.
          • Assign a Variable event to the first duplicate should have a Variable event. In the Value column choose 0, which means that we pick the first variable in the list (there are 128 of them numbered from 0 to 127, a bit like MIDI, except a Variable can hold anything OSC can carry: number, string, etc.).
          • Assign a OSC Routing to the second duplicate, and choose "New…" to create a new one.
        2. In the OSC Routing Parameters, in the targets table at the second line, click on the gear menu and choose the OSC target "this document". This defines a OSC target to which we can send OSC messages, and this targets happens to be the current document.
        3. At the bottom, you have the OSC routing you just created, change its rewrite address to the name of your fader. Here it is /1/fader1. We will use that OSC routing to update the value of the fader, so for the memo I used "Update Fader" to remeber what it is used for.
        4. Add two more OSC Routings by clicking the + button at the bottom, and change both of their targets to 2 to ensure they will be send to the current document. Both of them will use the rewrite address /change_cutoff. But they differ in their arguments:
          • The first one (which I called "Recall Cutoff") uses the variable 0 as argument, meaning when triggered, this OSC Routing will send a message to the address /change_cutoff with the value stored in the variable 0.
          • The second one (called "Change Cutoff") does not need any customization, it will merely send a OSC message with the address /change_cutoff with the value it is given on input.
            routings.png
        5. You can now close the Parameters window.
        6. Register the button in OSCulator, the message /1/push1 should appear in the main list. Select this message and hit Control-D. This will "demux" the message, which means that it will display the internal values and offer you a change to trigger something different wether it is pressed (value = 1) or released (value = 0).
          • for the released state, we want to reset the fader to its saved value, thus assign the OSC Routing "Recall Cutoff".
          • for the pressed state, we want to set the fader to what corresponds to the MIDI value 100. Assign the OSC Routing called "Change Cutoff". Because we expressed the values in terms of fader position, we must adujst the fixed value to 0.78 (100/127). Flip to the Scalings page (Command-F) and change output min and output max values both to 0.78.
        7. Finally, we need to configure the actual work in the /change_cutoff message. Since you must have pressed the buttons while constructing this mapping, you should see this message in the main list. If you don't just slide the fader or press the button. Now, duplicate the /change_cutoff message and:
          • assign a MIDI CC for the first duplicate.
          • assign the OSC Routing "Update Fader" for the second duplicate.
        The final result looks like this (you can also use the attached example) :
        reset fader.png

        I hope this answers your question, if you need more details please let me know.

        Best Regards,
        Cam
        Attached Files

        Comment


        • #5
          Hey Camille,

          So it worked like a charm. Thanks for taking the time to explain it all. The original idea was to create a matrix of different settings that could be changed with a single button pressed. As I was trying to keep my questions simple, I've run into a new issue that probably is due to my settings, but might be a bug.
          The original question was about returning a fader to a saved position after changing the value with a button. I decided after I got your last post working correctly, that I would use the second fader in "beat machine" (the blue one) to control another parameter, but use the first button attached to MIDI CC 10, to also change the new parameter.
          Ex.
          Fader1 - controls filter cutoff
          Fader2 - controls filter q
          Button1 - changes filter cutoff and q, and when released returns them to their previous position

          Actually everything works fine. I had to figure out that I needed to change the variable in the new fader to 1 from 0, but I got it working and everything is fine. Except...fader2 in touch OSC doesn't move with the button presses. Fader1 moves on the screen to the button value, then returns to the previous state, while fader 2 doesn't do anything when the button is pressed. This is just in touch osc. The plugin inside of Live responds exactly as expected.

          Anyway, I thought I'd pass that info along. Maybe there's something that I'm not setting up correctly?
          The larger idea is to have button1 change maybe up to 50 parameters when pressed, and return all those parameters to their previous state when released. I was hoping to have maybe 50 buttons that moved the same controls but each with different settings, but all return to the previous state. If you have any thoughts, let me know.

          Thanks,

          Jason

          Comment


          • #6
            Hi Jason,

            For the second fader, you need to create a OSC routing just like you did for /1/fader1, so its position set back to the value stored in the associated variable.

            About your last note: I fear I don't have a better solution. OSCulator is great when you have relatively simple setups, or when you need to translate OSC to something else, but for more complex logic it might not always be the best tool. I will see if your problem can be solved by a new feature.

            As always feel free to ask question whenever you need.


            Best,
            Cam

            Comment


            • #7
              Hey Camille,

              So for the second fader I did create a new variable and osc routing just like the first one. I think I attached the file here to this message. I'm pretty sure I did it right, but just in case I'm missing something here, or if it's a bug, you might want to know.

              Thanks man,

              Jason
              Attached Files

              Comment


              • #8
                Hi Jason,

                Your file looks right overall, though you don't need to create an extra (third) OSC target since you already created one.
                I can see there is a typo in the definition of the routing back for /midi/cc11/1, it says "/chnage_width" instead of presumably "/change_width". You should be able to get away simply by deleting the /midi/cc11/1 message, and let OSCulator recreate it for you.


                Best,
                Cam

                Comment

                Working...
                X