Announcement

Collapse
No announcement yet.

Trigger OSC messages off of specific velocities

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

  • Trigger OSC messages off of specific velocities

    SOLVED next page



    I'm trying to get OSCulator to use a variable in an OSC message from an encoder that uses Command Changes.

    When I turn my encoder Clockwise it gives a velocity of 1-10 (never got it higher no matter how fast I turned it.)

    And When I turn it Counter Clockwise it gives a velocity of 65-75 (Again never got it higher by turning it faster)

    CW and CCW are the same command change number just with different velocities

    I can very easily set a variable for the velocity and then stick it into an OSC message that will give an increasing value as I turn it faster which works perfectly.
    However my problem is with the CCW turn. I need my variable to start at 1 even when it is turned CCW. Is it possible to simply do something like "var21f -64" in OSCulator? (also I need my variable to be multiplied by 2.55 for my light software. Is that possible as well)

    However even if that were possible it won't fix my problem because both CW and CCW turns will trigger both variables when I turn them because they are simply picking up any velocity that comes from the specific Command Change. What I need is for my CW variable to omit sending any value higher than 64 and for my CCW variable to omit sending any value lower than 65 and then subtracting the sent value by 64, and then invert the value to the negative (Which I can do with scaling).

    I don't think that scaling can fix this issue because when I tried, it just halved my numbers when I capped the scale at 64. What I need is for it to omit sending any number that's higher than a given range of numbers

    edit- I have already tried demultiplexing but that simply gives me a bunch of numbers (0 to .1[CW] and .5 to .6[CCW]). I can put OSC messages on each of them which is what I did before successfully. But sometimes when I turn my encoder I will get a new value that wasn't there before and therefore has no message attached to it. I can input multiple OSC messages and increase the output number I need my software to read as the values increase from the command change; I can even start my negative output number from where the CCW value starts, but that is a manual way of doing things and again sometimes I have new values that pop up. The best solution is being able to trigger OSC messages starting at a certain value as I described earlier.

    Manual solution Screen Shot 2018-02-07 at 4.33.07 PM.png
    Attached Files
    Last edited by Fornez; 02-13-2018, 12:13 PM.

  • #2
    Hi Fornez,

    I believe you should get away with proper scaling values.

    First, you want to duplicate your message to be able to have two outcomes.

    Then you want to “cap” input so only input if the specified range triggers an OSC Message event.

    The rule to configure scaling is as follows:
    Input min and max should be set to the known min and max values of the input range. Output min and max should be set to the desired output range.

    So, input range would be 1-10 for the first duplicate, and 65-75 for the second.

    Please tell me if that helps.

    Best,
    Cam

    Comment


    • #3
      I'm still unsure nothing I have tried has worked so far

      I need the variable to be capped and it doesn't seem to be doing anything. The output scaling is still scaling the numbers not "cutting them off"

      I think I'm interpreting your info wrong so here is what I thought you were saying

      Screen Shot 2018-02-07 at 7.23.35 PM.pngScreen Shot 2018-02-07 at 7.23.52 PM.png

      You can see in the monitor what my OSC message is doing 2.55 is a CW turn and it works correctly and scales up when I rotate the encode faster. However it still triggers the CCW turn which is 25.5. This means that both directions are increasing the red color in my program when In this scenario I want my CCW turn to do nothing.

      The output max scaling was set so that I would get increments of 2.55

      After I get this working I want to add in a second variable and a second OSC message for the message that lowers the color red

      Comment


      • #4
        Hi Fornez,

        You said you controller was using velocity to encode a knob rotation but I can see you are using a MIDI CC, this seems different from your initial description. I am not sure of what you need in term of output, could you please describe precisely what input you have and what output you desire?

        Using Cap in the scalings page will help you filter the input from the specified range. You said the range 1-10 was for CW movement, and 65-75 for CCW, so using Cap with those two range must be correct.

        From the first screenshot I can see you are using a variable (var[21]), are you sure you need one? The variable event is in second position, which means it sets the received value after the OSC message (in first position) is sent. That might explain why the OSC messages are not what you expect.

        Cam

        Comment


        • #5
          Ok I might have the wrong terminology, I've been trying to learn exactly what is what as far as MIDI goes

          Here is my control surface the top row of knobs are my encoders and i'm using the farthest left one

          So here is what I get as far as input when I turn the encoders
          Screen Shot 2018-02-08 at 3.55.17 PM.png

          And here is when I turn them faster CW and CCW
          Screen Shot 2018-02-08 at 3.57.09 PM.pngScreen Shot 2018-02-08 at 3.57.44 PM.png

          If I set up my encoder like this (i've since swapped the variable and OSC message)
          Screen Shot 2018-02-08 at 4.01.30 PM.png

          I can see the number increasing with the speed of my turn
          Screen Shot 2018-02-08 at 4.04.03 PM.pngScreen Shot 2018-02-08 at 4.04.16 PM.png

          In this example I would need both directions of my knob turn to produce an osc message like this /test/Value--->/1 for CW and /test/value--->/-1 for CCW

          Then if I turned them faster CW should look like
          /test/Value--->/1
          /test/Value--->/1
          /test/Value--->/2
          /test/Value--->/3
          /test/Value--->/3 (relative to the speed of the knob turn)

          and CCW should look like
          /test/Value--->/-1
          /test/Value--->/-1
          /test/Value--->/-2
          /test/Value--->/-3
          /test/Value--->/-3

          Clockwise is functioning perfectly however counter clockwise is not. Right now it looks like the above picture which for example would look like this
          /test/Value--->/65
          /test/Value--->/65
          /test/Value--->/66
          /test/Value--->/66
          /test/Value--->/67 (Which doesn't work for my light software, it's too high of a number so I lose my precision)

          So in summary
          B0 10 41 Control 16 Value 65 Ch1, needs to become /test/Value--->/-1 and still be able to scale up as I turn it faster. While /test/Value--->/1 needs to stay /test/Value--->/1

          All of this coming from one single source, my encoder. I hope that explains why I need the variable (as far as I know)

          As far as the input range I think I might have confused you. The full range of the input is 0-127 because it is a control change like any other. I was simply saying that it never goes above 75 when turned CCW.
          Here is a picture of what happens even when I use the scalings page. (I think I set this up wrong but no matter what both directions send an OSC message)
          Screen Shot 2018-02-08 at 4.33.22 PM.png
          In this example there should not be an OSC message triggered when I turn it CW (Control 16 Value 1 Ch1)
          There should only be an OSC message when I turn it CCW (Control 16 Value 65 Ch1)

          I tried putting the variable on top like you said and it did change things but in this example CCW is still sending info even though the variable is capped
          Screen Shot 2018-02-08 at 4.44.31 PM.png (I changed the scalings for this, also the first set of events is deactivated so I could test only 1 direction)
          Attached Files
          Last edited by Fornez; 02-08-2018, 11:52 PM.

          Comment


          • #6
            I just saw the split command and tested that but it doesn't work the way that I thought it would

            Again turning the Encoder CW or CCW triggers both messages

            Control 17 Value 1 Ch1 = CW input
            Control 17 Value 65 Ch1 = CCW input

            Screen Shot 2018-02-09 at 6.24.15 PM.png setup + input and output monitor

            Screen Shot 2018-02-09 at 6.24.27 PM.pngDefault Scaling page. I also tried flipping the scaling on (lo) with no change
            Last edited by Fornez; 02-10-2018, 01:35 AM.

            Comment


            • #7
              Hi Fornez,

              Your last message illustrate exactly what I tried to explain in my previous post, except you have the scalings wrong.

              Start for this config (one message splitted), and adjust input ranges to 1-10 for the first duplicate, and 65-75 for the second. This corresponds to the splitting points you initially described. Output values do not matter since you are sending constant OSC messages anyway.

              As you see, variables are not needed to do that, only clever scaling and a couple of pre-configured OSC messages.

              Now, if you want to send an OSC message with a value of 1 or -1, go to the OSC Route editor, and type 1 or -1 in the arguments fields, followed by the space key. This will create a static token. Do this twice for both desired messages.

              Let me know if that helps.

              Best,
              Cam

              Comment


              • #8
                So what you described I could already accomplish very easily. I had already done that. What I need is for the number to scale with the knob turn. A static Token can't scale so it will not work. This is why "I think" that I need to use a variable so that my OSC message will scale

                I detailed that as much as I could in my second response (the long one)

                Comment


                • #9
                  In the OSC Routing editor, have you tried using an « arg[0] » token or just leaving the « all args » token ?

                  This will output the value according to the scaling defined in output min and output max.

                  Comment


                  • #10
                    I got it! Thank you! I had deleted the <all arguments> token. When I first started OSCulator I didn't know what that did so I deleted it from my message.

                    That wasn't the final part though, I've been using a lot of enable events to trigger certain things including multi button presses. I came up with a solution that works except for one problem. Here's a video



                    When both turns are enabled (CW and CCW) they both trigger their OSC message. So I use an enable command to trigger one on and one off at the same time so that only one or the other is active. This way I can separate the two events. The enable commands have to be on top. However in the video after I demonstrate it working correctly I demonstrate the one problem.

                    The CW event has to be enabled when the file is loaded in order to work. If the CCW event is enabled when the program starts then the opposite values that I want to trigger, trigger. This is a problem because OSCulator saves all changes as they happen. So if I close the file with CCW enabled, when I load it I will get the problem of the opposite values being triggered. You can see this at the end of the video.

                    This could be solved by locking the OSC file with the correct settings but there is one additional issue that I have found. OSCulator does not trigger a message when Mappings are restored when the file is locked. It does for the very first mapping, but if you switch mappings after it loads the first mapping, it does not. This is a problem for me because I use a startup mapping and then trigger a command to switch to my normal mapping after. If OSCulator triggers a message when switching mappings from the first mapping (when locked) then I could make sure that CW always starts enabled so that I never have the issue of the wrong values being sent.

                    The only way I could demonstrate this would be to film my actual control surface not reacting as it should when the file is locked as opposed to when it is not locked. I'd be willing to do this if it would help but I can confirm that there is an issue here.

                    Comment


                    • #11
                      Hi Fornez,

                      When both turns are enabled (CW and CCW) they both trigger their OSC message. So I use an enable command to trigger one on and one off at the same time so that only one or the other is active. This way I can separate the two events.
                      This is the purpose of the "Cap" option in the scalings.
                      The fact the both OSC messages are sent looks like a bug.

                      Let me check that, I will send a fix to your e-mail address.


                      Best,
                      Cam

                      Comment


                      • #12
                        the update worked perfectly! thank you very much!

                        Comment

                        Working...
                        X