Decode tone from CC32 CC00 PC midi messages

Home Forums General Programming Decode tone from CC32 CC00 PC midi messages

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #84445
    Quimquim
    Participant
      • Topics: 7
      • Replies: 23
      • Total: 30

      When my keyboard send a tone change it allways send the CC0 CC32 and PC messages. So I’m looking for a way to get tone name in a list from the 3 messages.

      I found a way to send the tone change with the 3 messages from a tone list in the Combo content of a uiCombo modulator ( look at the Roland VR09 / VR730 V-Combo EDITOR v1.12 )

      The Combo content contain a list of “Tone Name” = xx yy zz where xx = msb yy = lsb and zz = PC

      a Lua code extract the Tone name to send it to a LCD display and the msb lsb PC to build the midi messages

      My other modulator work well in both way because they are single standard midi message and ctrlr decipher the message by it self.

      But for the Tone, viewing that it’s split in 3 messages and it’s sent by a Lua method ctrlr can’t
      directly ( as far as I know ) decode it directly.

      So I’m working on the code to reverse the process ie: when the keyboard send the 3 messages want to extract the msb lsb and PC ( this is the simple part ) and find the Tone name from these 3 values. ( the other part )

      Probably will have to use a three dimension array to manage 900+ tone list. Unless you can imagine another way to do it feel free to share.

      Stay tuned. Quimquim

      #84452
      Possemo
      Participant
        • Topics: 14
        • Replies: 638
        • Total: 652
        • ★★★

        Ok, you know that any modulator will react to incoming messages but in this case this won’t do the trick.

        Are these tones preset-tones or are they editable? For preset tones you could make a Lua table with all names and get the name with a script everytime you receive a BC/PC.

        When the names are editable I would request a tone-sysexdump everytime a Bank/ProgramChange is received. On most synths the name is somewhere packed in the dump. While your’e on it you could process the whole dump and assign values to the modulators to make the panel reflect the actual patch.

        #84456
        Quimquim
        Participant
          • Topics: 7
          • Replies: 23
          • Total: 30

          Hi Possemo, Following you suggestion I read on the Lua site about tables.
          My programming knowledge come from visual Basic so I was using arrays to store data list and they’re indexed only by number. That’s why I was planning to use a 3 dimentions array and index each dimention with the values of msb lsb and pc.

          The Lua tables are very interesting because you can index the elements with anything (string or value ) so I only have to combine the 3 values in a string to index the elements.

          My arranger tones are preset only so I will only have to build a global table at the startup of the panel so it will be usable in every method I want to.

          Since how many year are you using ctrlr? I look to have a lot of experience with it.

          Thanks for suggestions.

          Stay tuned. Quimquim

          #84457
          Possemo
          Participant
            • Topics: 14
            • Replies: 638
            • Total: 652
            • ★★★

            I don’t know exactly but it’s been a few years ago when I started improving an already available SuperJX panel. I had very few experience with visual Basic and VBA before. There are a few forum members who know a lot more than I do.

            I have never done a BankNr/PatchNr-to-Name procedure. There are probably a hundred ways to do it.

            #84458
            Quimquim
            Participant
              • Topics: 7
              • Replies: 23
              • Total: 30

              Hi Possemo I’ve written my tone table initialisation method and it work very well.

              Now I’m work on the method to extract the MSB, LSB and program # from the 3 messages.

              It work well also but one thing I Wonder is why each message are process twice.

              See attached picture.

              Attachments:
              You must be logged in to view attached files.

              Stay tuned. Quimquim

              #84460
              Quimquim
              Participant
                • Topics: 7
                • Replies: 23
                • Total: 30

                I again Possemmo, I made a little mistake in one console message suppose to read 0=MSB 32=LSB.

                I also check when a modulator send a message an it’s process twice also.

                Another question is it possible to process only output, or only input messages? Actually the method receive both way.

                Stay tuned. Quimquim

                #84467
                Possemo
                Participant
                  • Topics: 14
                  • Replies: 638
                  • Total: 652
                  • ★★★

                  the “doubly input message processing” is a known bug. I believe it was goodweather that came with the workaround. Put this in the method attached to “Called when the panel has finished loading”:

                  	-- Reset Midi INPUT device to avoid having MidiMessageReceived method called twice
                  	local sMidiDevices = panel:getProperty("panelMidiInputDevice")
                  	panel:setPropertyString("panelMidiInputDevice", "-- None")
                  	panel:setPropertyString("panelMidiInputDevice", sMidiDevices)
                  #84471
                  Quimquim
                  Participant
                    • Topics: 7
                    • Replies: 23
                    • Total: 30

                    Thanks again Possemo it work fine. You see this a perfect example of information who could be placed in a tutorial section of the forum.

                    And about the possibility to process the input and output seperately is it possible?

                    Stay tuned. Quimquim

                    #84472
                    Possemo
                    Participant
                      • Topics: 14
                      • Replies: 638
                      • Total: 652
                      • ★★★

                      input / output: I don’t understand. Can you explain it some more? Usually midiReceived will process input, not output.

                      #84473
                      Quimquim
                      Participant
                        • Topics: 7
                        • Replies: 23
                        • Total: 30

                        If you look at the picture I’ve post higher this method run no mather if it’s an output or input message.

                        The call is placed in the Panel at the line Called when a panel receive a MIDI message, but when I modify a modulator value to send a message out the method also run. If I look at the midi monitor, the message appear on both output and input.

                        It’s like there is a kind of loop back somewhere.

                        What should I modify so it run or analise only for input message or to stop the output message to get back in?

                        Stay tuned. Quimquim

                        #84474
                        Possemo
                        Participant
                          • Topics: 14
                          • Replies: 638
                          • Total: 652
                          • ★★★

                          I’ve never seen this. I just tried with this simple method:

                          myNewMethod = function(midi)
                          
                          	test = midi:getData():getByte(1)
                          
                          console(tostring(test))
                          end

                          When I move sliders it does not run, it does not show anything in the console. When I send data from the synth it runs as it should.

                          Could it be that there is a kind of merge midi-in to midi out enabled on your synth?

                          • This reply was modified 5 years, 8 months ago by Possemo.
                          #84476
                          Quimquim
                          Participant
                            • Topics: 7
                            • Replies: 23
                            • Total: 30

                            Actually I’m doing my testing with loopbeOne and MIDIOX

                            I was using midimessage instead of midi in the function so I tried your little method and it do the same.

                            I tried to close close MIDIOX and still the same. Then I mute LoopBeOne and it stop.

                            So I think that’s LoopBeOne who is looping the message because I observed also if I send a message with MIDIOX I see it on the output and Input too.

                            Thanks for the testing

                            Stay tuned. Quimquim

                            #84478
                            dnaldoog
                            Participant
                              • Topics: 4
                              • Replies: 480
                              • Total: 484
                              • ★★

                              Hi QuimQuim

                              
                              function getPatchName(midi)
                               local t={}--initialise table
                                  if midi ~= nil then
                                      programData = midi:getData():getRange(1,24) --actually 0,23
                                             for i = 8, 23 do
                                          local z=string.char(tonumber(programData:getByte(i),10))
                                          table.insert(t,z)
                                      end
                              end --~=nil
                              local myPatchName=trim(table.concat(t)) -- remove trailing leading space
                              console(String("patch name = ["..myPatchName.."]"))
                              	t={} -- reset array; as it is local probably not necessary
                              	return myPatchName
                              end --function
                              ---------------------------------------------------------
                              function trim(s)
                                  return (s:gsub("^%s*(.-)%s*$", "%1"))
                              end --function
                              

                              F0 [ 41 10 57 12 [*06 0A 00 00] [** 44 69 67 69 74 61 6C 20 52 68 6F 64 65 73 20 20 ]] = 24 bytes ignoring F0
                              therefore loop starts at 8 (0x44) + 15 = 23 hence loop for i=8,23 (0x41 is position 0)
                              This patch name = Digital Rhodes
                              http://www.convertstring.com/EncodeDecode/HexDecode
                              * = memory address
                              **=start of data

                              I would request a tone-sysexdump everytime a Bank/ProgramChange is received. On most synths the name is somewhere packed in the dump.

                              What Possemo said is right. On the Roland synths that I know [JD-990 JV-1010] the patch name is the first 16 bytes in the data residing at any address. The trick is to loop through those 16 bytes after dumping the patch as sysex and converting to a string (see above function).

                              #84483
                              Quimquim
                              Participant
                                • Topics: 7
                                • Replies: 23
                                • Total: 30

                                Thanks for the suggestion Dnaldoog but my keyboard is an arranger not a synth. So the tones list is not modifiable and there is no dump function for it.

                                But for the tones list names and their address I copied the list from the pdf manual to excel and build the table assignment with an excel formula, this avoid abunch of typing, see short extract below. Then copy that list to Lua and it work very well. The hex numbers used as index are combined MSB bank CC00 LSB bank CC32 and tone # PC

                                So when the keyboard send a tone change I combine the 3 messages data and use this combined value as the index to find the tone name in the table and display it on an LCD modulotor on the panel.

                                toneTable = {}
                                toneTable[“000400”] = “NaturalPiano”
                                toneTable[“2F0400”] = “SuperiorPian”
                                toneTable[“000401”] = “ClassicPiano”
                                toneTable[“010400”] = “UprightPiano”
                                toneTable[“010401”] = “Brite-Piano”
                                toneTable[“020400”] = “Mild-Piano”
                                toneTable[“2D0400”] = “MonoAcPiano”
                                toneTable[“020401”] = “Rock-Piano”
                                toneTable[“180400”] = “Piano+String”
                                toneTable[“1A0400”] = “Piano+Choir”
                                toneTable[“2F0402”] = “StackedPiano”

                                Take note of the excel trick. It can sve hours of typing in that kind of situations.

                                Regards

                                Stay tuned. Quimquim

                                #84504
                                dnaldoog
                                Participant
                                  • Topics: 4
                                  • Replies: 480
                                  • Total: 484
                                  • ★★

                                  Oh I see!

                                  Well good luck.

                                  You can sometimes save a lot of initial typing by using this:

                                  https://www.onlineocr.net/

                                  Regards,

                                  #84512
                                  Quimquim
                                  Participant
                                    • Topics: 7
                                    • Replies: 23
                                    • Total: 30

                                    Hi Dnal this is good when you can’t copy and paste directly from the PDF or other files. I my case it was possible the copy the data and paste it in Excel. Also in Excel I can build ready to use Lua coding from the data.

                                    Then just copy it and paste in the method.

                                    All tricks are good to note.

                                    Thanks for the info.

                                    Stay tuned. Quimquim

                                  Viewing 16 posts - 1 through 16 (of 16 total)
                                  • The forum ‘Programming’ is closed to new topics and replies.
                                  There is currently 0 users and 64 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