update panel on dump request using Lua

Home Forums General Programming update panel on dump request using Lua

Viewing 20 posts - 1 through 20 (of 32 total)
  • Author
    Posts
  • #376
    msepsis
    Participant
      • Topics: 219
      • Replies: 732
      • Total: 951
      • ★★★

      Hi Atom,
      I’ve finally gone from [i:xo9k1j2f]dinking around[/i:xo9k1j2f] with your Lua examples to just [i:xo9k1j2f]digging in[/i:xo9k1j2f]…

      so. for now…

      going off the DEMO-midi Lua example,

      m = CtrlrMidiMessage({0xF0, 0x01, 37, 5, bank:getModulatorValue(), program:getModulatorValue(), 0xf7})

      I get the learning example here of passing a modulator’s knob value to a script (here the bank and program number of the DSI morpho synth) but suppose I just want to do a dump request of the synth’s [i:xo9k1j2f]edit buffer[/i:xo9k1j2f] and I have the precise sysex string to do so already working with a pre-existing button on my panel

      I don’t understand the "0x" before the F0, 01 and f7 but not the 37 or 5.

      Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

      #2924
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        the 0x means it’s a hex notation (the compiler will interpret the numbers as hexadecimal not decimal numbers)

        #2925
        msepsis
        Participant
          • Topics: 219
          • Replies: 732
          • Total: 951
          • ★★★

          so
          [f0 01 25 05 00 2a f7]

          the 25 and 05 are binary? so this synth uses a combination of binary and hex values in it’s sysex command to request a dump?
          The question I was asking isn’t what is the 0x for, my question is why the inconsistency between hex and binary in the sysex string in your DEMO.midi panel

          Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

          #2926
          atom
          Keymaster
            • Topics: 159
            • Replies: 2945
            • Total: 3104
            • ★★★★★

            no it’s HEX and DEC, so 37 is actualy 0x25 it’s just a matter of notation the value is the same.

            #2927
            msepsis
            Participant
              • Topics: 219
              • Replies: 732
              • Total: 951
              • ★★★

              right.. of course. I knew better <img decoding=” title=”Smile” />

              So I have the microwave XT panel updating modulators all using Lua now, I haven’t yet gotten to the knobs which get their messages from a sysex parameter change but if I have any questions setting up those arrays I’ll ask here.

              Thanks for the help, I think I’m finally past the logjam of how to get started w/ Lua.. Only programming I really know well are things like MEL, scripting in After Effects, actionscripting, some javascript… Lua seems powerful and I’m really excited to be getting the hang of this. Unfortunately I’ll be putting it all away for about a month here in a day or so – getting married and sitting on a beach in Hawaii for two weeks! i can not wait. . both for the beach and to get back and dig right back into this stuff!!

              Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

              #2928
              atom
              Keymaster
                • Topics: 159
                • Replies: 2945
                • Total: 3104
                • ★★★★★

                Aloha <img decoding=” title=”Smile” /> and a happy marriage/wedding.

                #2929
                msepsis
                Participant
                  • Topics: 219
                  • Replies: 732
                  • Total: 951
                  • ★★★

                  Thanks Atom, one quick one… lets say you want to display a modulator’s visible name in a ui label, since I am setting all the unique names to AbbrCamelCaseLabels for scripting purposes… instead of %n = %s %v what would I use in place of %n which displays a unique name?

                  Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                  #2930
                  atom
                  Keymaster
                    • Topics: 159
                    • Replies: 2945
                    • Total: 3104
                    • ★★★★★

                    %N is the visible name (non unique)
                    %n is the modulator name (unique)

                    #2931
                    Filch
                    Participant
                      • Topics: 22
                      • Replies: 173
                      • Total: 195
                      • ★★
                      "msepsis":2giil2d5 wrote:
                      Thanks Atom, one quick one… lets say you want to display a modulator’s visible name in a ui label, since I am setting all the unique names to AbbrCamelCaseLabels for scripting purposes… instead of %n = %s %v what would I use in place of %n which displays a unique name?[/quote:2giil2d5]

                      Does LUA require the unique names to be in single word format, or does
                      [b:2giil2d5]getModulatorByName("filterResonance")[/b:2giil2d5] work just the same as
                      [b:2giil2d5]getModulatorByName("Filter Resonance")[/b:2giil2d5] if that’s what your unique name is?

                      I’d really hate to have to go back and rename all of these

                      #2932
                      atom
                      Keymaster
                        • Topics: 159
                        • Replies: 2945
                        • Total: 3104
                        • ★★★★★

                        it has to be the same as the unique name in the panel, doesn’t matter if it’s all spaces or something.

                        #2933
                        Filch
                        Participant
                          • Topics: 22
                          • Replies: 173
                          • Total: 195
                          • ★★

                          Fantastic.

                          I’m reworking your midi example for the Blofeld. Without it, this would be going nowhere <img decoding=” title=”Smile” />

                          With that said, a modulator name list/table would be VERY handy right about now. <img decoding=” title=”Wink” />

                          #2934
                          atom
                          Keymaster
                            • Topics: 159
                            • Replies: 2945
                            • Total: 3104
                            • ★★★★★

                            there is a nasty quick mock-up of a modulator list in latest build, you can see the button in the panel toolbar.

                            #2935
                            msepsis
                            Participant
                              • Topics: 219
                              • Replies: 732
                              • Total: 951
                              • ★★★

                              Ok, so regardless of the fact that the code below works, it’s still giving me a runtime error when I test with the bug icon in ctrlr’s Lua method editor.. what is the cause of the error? Atom this is basically your script from your Demo MIDI panel. That panel also fires a runtime error when tested, FYI.

                              [code:3tuzo200]

                              — Check length of incoming midiMessage, if 265 bytes then it’s a sysex dump

                              midiMessageReceived = function(midiMessage)
                              s = midiMessage:getSize()
                              if s == 265 then
                              out = panel:getModulatorByName("outputLabel")
                              out:getComponent():setPropertyString ("uiLabelText", midiMessage:toString())
                              console("received program data")

                              assignValues(midiMessage)
                              end
                              end

                              [/code:3tuzo200]

                              Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                              #2936
                              atom
                              Keymaster
                                • Topics: 159
                                • Replies: 2945
                                • Total: 3104
                                • ★★★★★

                                what is the error, the debug icon is a bit weird it should work but i saw it behaving weird (this icon creates a new LUA context and tries to run everything in that). It should give a bit more info on what’s happening, do you have the assignValues() methods defined too ?

                                #2937
                                netchose
                                Participant
                                  • Topics: 15
                                  • Replies: 70
                                  • Total: 85

                                  this example is ok for me.
                                  what is the next step ?
                                  do we need documentation to analyse and understand the midi dump result?

                                  #2938
                                  atom
                                  Keymaster
                                    • Topics: 159
                                    • Replies: 2945
                                    • Total: 3104
                                    • ★★★★★

                                    yest, without the knowledge about the sysex format that the device sends, you can’t do anything with it (perhaps maybe save it to a file as a backup).
                                    All the information about the sysex format should be in the manual for the device.

                                    #2939
                                    netchose
                                    Participant
                                      • Topics: 15
                                      • Replies: 70
                                      • Total: 85

                                      i v’e found a little utility : evolview http://www.trevorg.net/evolver/ very usefull to understand the evolver program data dump.
                                      but even with this kind of documentation it will be a very long and hard job. if it will possible to save program in a CTRLR format it will be not necessary

                                      #2940
                                      msepsis
                                      Participant
                                        • Topics: 219
                                        • Replies: 732
                                        • Total: 951
                                        • ★★★
                                        "atom":damf92p7 wrote:
                                        what is the error, the debug icon is a bit weird it should work but i saw it behaving weird (this icon creates a new LUA context and tries to run everything in that). It should give a bit more info on what’s happening, do you have the assignValues() methods defined too ?[/quote:damf92p7]

                                        the error I get from the snipit I pasted above is the same error I get when testing your midiMessageRecieved script on your "DEMO – Midi" panel – "CALL FUNCTION EXCEPTION: lua runtime error"

                                        I do have the assignValues() methods… a good number of them, almost one for every knob on my panel.. they do pass values to the knobs and it’s mostly working but I noticed this error when testing so i took out the assignValues() to test and identify where the error was coming from… it seems to be coming from what I pasted above, which again is the same error I get from your panel.. I guess I’ll ignore it, just annoying that there isn’t more info than that and it seems this button isn’t to be relied on for testing scripts. hmmm. I’ll come back to it.. I’m winding down my work on this panel till I come back to earth in a few weeks <img decoding=” title=”Smile” />

                                        thanks atom for all your work on this and helping out.

                                        Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                                        #2941
                                        atom
                                        Keymaster
                                          • Topics: 159
                                          • Replies: 2945
                                          • Total: 3104
                                          • ★★★★★

                                          you can’t have multiple assignValues() methods you can have one, if you have multiple the last one compiled will only work. It’s a global lua context the names must be unique for methods and variables, you can define a variable in a method for one slider and access it in some other slider, it’s all one big memory segment. You need to think globaly in terms of the panel, no localy for just one modulator. It has to build like that otherwise it makes no sense at all.

                                          #2942
                                          atom
                                          Keymaster
                                            • Topics: 159
                                            • Replies: 2945
                                            • Total: 3104
                                            • ★★★★★

                                            as for the complexity of the task…

                                            well it’s not simple but it’s the creators job to figure out a way to make it simple. The perfect way would be for the manufacturer to supply XML documents for their devices in a well formatted standard way. A XML that describes all the parameters their min max values their types, the sysex dump format and all the MIDI stuff that happens, instead each manufacturer provides a different document for that. Each document is written in a different way, there is no standard, so it’s your job to translate that document to some language that Ctrlr will understand.

                                            I gave an example that shows ONLY how to interact with the elements in the panel, how you will interact with the document that describes the sysex format is up to you. If you have some text representation of the format you can paste the whole thing and just parse it on the fly, you can design your panel in a way that will make this interaction easier.

                                            In the end you need to figure out a way to get the information from the manufacturer docs into Ctrlr so that writing your LUA script will be easy.

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