Slider with multi part message Program Change above 128

Home Forums General General MIDI discussion Slider with multi part message Program Change above 128

Tagged: , ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41812
    neofelismale
    Participant
      • Topics: 1
      • Replies: 3
      • Total: 4

      Short explanation: I have a Roland VB-99 that I like to use with ctrlr. The VB-99 has 400 Memory, Patch storage locations. It organizes this in banks on CC #0 1 to 4 and uses Program Change 1-100.

      How do I go about doing this, have a slider Dec/Inc button with a number of 1-400 that sends messages of type first a CC with bank number, than a Program Change value. One bank number CC 1 to 100, than next bank number and so on, displaying all the numbers as 1-400. Side note, the VB-99 does not respond to anything on CC #32.

      Monitor message of one change:

      [23:57:55:000002]: Time(1421096584) [Controller] Ch:[ 7] No:[ 0] Val:[ 1] RAW:[b6 00 01]
      [23:57:55:000003]: Time(1444991789) [Controller] Ch:[ 7] No:[ 32] Val:[ 0] RAW:[b6 20 00]
      [23:57:55:000004]: Time(1460311738) [Program change] Ch:[ 7] No:[ 7] Val:[—-] RAW:[c6 07]

      Thanks in advance for any help

      #41896
      dasfaker
      Keymaster
        • Topics: 80
        • Replies: 793
        • Total: 873
        • ★★★

        You can create a simple scritp and assign it to modulator’s method “called when the modulator value changes”. Also, set the midi message type to none

        myMethod = function(mod, value)
        
        if value < 101 then
           m = 	CtrlrMidiMessage({0xb0, 0x00, 0x01})
           panel:sendMidiMessageNow(m)
           m = 	CtrlrMidiMessage({0xc0, value})
           panel:sendMidiMessageNow(m)
        elseif value > 100 and value < 201 then
           m = 	CtrlrMidiMessage({0xb0, 0x00, 0x02})
           panel:sendMidiMessageNow(m)
           m = 	CtrlrMidiMessage({0xc0, value- 100})
           panel:sendMidiMessageNow(m)
        elseif value > 200 and value < 301 then
           m = 	CtrlrMidiMessage({0xb0, 0x00, 0x03})
           panel:sendMidiMessageNow(m)
           m = 	CtrlrMidiMessage({0xc0, value - 200})
           panel:sendMidiMessageNow(m)
        elseif value > 300 and value < 401 then
           m = 	CtrlrMidiMessage({0xb0, 0x00, 0x02})
           panel:sendMidiMessageNow(m)
           m = 	CtrlrMidiMessage({0xc0, value - 300})
           panel:sendMidiMessageNow(m)
        end
        end

        Be aware that this is for a fixed midi channel (in this script is always channel 1), but this can be controlled with a variable.

        I’ve not tested it, but give it a try and let me know if it works.

        • This reply was modified 9 years ago by dasfaker.
        • This reply was modified 9 years ago by dasfaker.
        #41949
        neofelismale
        Participant
          • Topics: 1
          • Replies: 3
          • Total: 4

          Thanks for the try. It totally crashed my ctrlr, every time I start I get an error. Tried to move all my panels to new locations, still no go.

          I will be back with new info when I get ctrlr up and running.

          #41950
          neofelismale
          Participant
            • Topics: 1
            • Replies: 3
            • Total: 4

            All good now 🙂

            From Atom “there is a special way to do this, when starting Ctrlr hold CTRL+R, it should clear stuff up,”

            Will look more into your script tomorrow.

            #42155
            neofelismale
            Participant
              • Topics: 1
              • Replies: 3
              • Total: 4

              Guess I was tired yesterday, just a few adjustments and the script runs fine.
              I had to add a -1 one to the value else the logic gets wrong. And I was wrong about bank 1 to 4, it was 0 to 3.

              But this got me thinking, that range conversion must be quite a big thing in programs like this. And that a general easy to use formula could help out many people not so much in to math. I found this formula on http://rosettacode.org/wiki/Map_range#Lua, but I can not figure out how exactly to use this in ctrlr, this could also been used to solve this issue:

              It could be modified to take range variables of the fader and its step value, then have some easy explainable variables to add the new range:

              function map_range( a1, a2, b1, b2, s )
              return b1 + (s-a1)*(b2-b1)/(a2-a1)
              end

              for i = 0, 10 do
              print( string.format( “f(%d) = %f”, i, map_range( 0, 10, -1, 0, i ) ) )
              end

              Here is the working script I use now:

              myMethod = function(mod, value)

              x = -1

              if value < 101 then m = CtrlrMidiMessage({0xb0, 0x00, 0x00}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value + x}) panel:sendMidiMessageNow(m) elseif value > 100 and value < 201 then m = CtrlrMidiMessage({0xb0, 0x00, 0x01}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 100 + x }) panel:sendMidiMessageNow(m) elseif value > 200 and value < 301 then m = CtrlrMidiMessage({0xb0, 0x00, 0x02}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 200 + x}) panel:sendMidiMessageNow(m) elseif value > 300 and value < 401 then m = CtrlrMidiMessage({0xb0, 0x00, 0x03}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 300 + x}) panel:sendMidiMessageNow(m) end end Thank you, feel like a level up now 🙂

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘General MIDI discussion’ is closed to new topics and replies.
            There is currently 0 users and 70 guests online
            No users are currently active
            Forum Statistics
            Threads: 2,495, Posts: 17,374, Members: 77,605
            Most users ever online was 12 on January 22, 2019 3:47 pm
            Ctrlr