Recommendations from the more experienced in the Max6 community, part 1

    Jul 14 2013 | 9:14 pm
    I'm working on a pretty big patch. I'm only using Max6\MIDI\JS objects; no DSP or video. No Java, etc.
    In one subpatch, I'm using several parameters in association with a preset\pattrstorage mechanism.
    In an effort to be more efficient and as simple and straightforward as possible, I've managed to consolidate ten 1x16 matrixctrl objects into one 10x16 matrixctrl (under the assumption that it will be more efficient). Is there a similarly efficient way to consolidate 16 occurrences of 5 number objects, and 16 occurrences of textedit objects ?
    The goal is to address and control all preset parameters via JS. This only needs to work at human interface speed, so there's no reason I can see why not to do things this way.
    Any comments ? Am I going the right way ?

    • Jul 14 2013 | 11:31 pm
      maybe that is not really what you wanted to hear ... but if you are looking for efficiency you shouldnt be using javascript at all, at least not for a realtime process such as modulating parameters.
      to make numberboxes consume less CPU you can try to add something like [speedlim] before sending "set 0.963733" to [flonum].
    • Jul 15 2013 | 12:51 am
      Thanks for the response, Roman, I obviously left too much out in my description. It was a much simpler question than that, or so I thought. These num boxes, etc., are storing static values from 128 presets to be used in minimal calculations, namely comparisons. I'm using the JS only at human interface speed, so it's not timing critical. The JS calls it, the JS posts it, and it's set in the right place until the next preset selection replaces it, again at human speed.
      My question was really just about reducing the sheer number of these numboxes, and other Max objects. I don't know whether it's common for patch preset designs to include 70 number objects in a preset much less the 160 binary values I'm using in the matrixctrl object. I thought it wise to replace 10 objects with one. I know that I replaced about 180 objects with some lines of JS to do the same thing as 180 objects. I'm just looking to benefit from others' expertise and experience in a similar way.
      With some of the realtime manipulation in another part of my project (again, only MIDI data), I've been contemplating using C for the sort of performance reasons I think you refer to, but not in this particular instance. I will try it with standard Max objects first, and see if there is even a need to put it into C, or dare I say, Java. I'm really not much of a programmer at this point. If there turn out to be performance issues in the realtime manipulation, I'll be looking around for a hired gun to take that task on.
      So any further thoughts ?
    • Jul 15 2013 | 7:40 am
      in terms of such amount of objects and accessing them through js , i would consider to create UI from scratch in JSUI , but thats only me .
    • Jul 15 2013 | 8:44 am
      Not sure exactly what you're asking here, but I'm working on a config screen for my Launchpad controller that consists of 90+ bpatchers (for grid cells etc) and each bpatcher consists of around 10 menus/int values for configuring a cell. All of the contents of each cell and each cell is created, loaded, managed and saved via JS.
      Does that answer your question? :)
    • Jul 15 2013 | 8:52 am
      well, maybe you can work with lists of "0.1 0.5 1.0 1.3333" ?
      then you can - at some places in the patcher - convert it to a symbol and have to send only one thing. i sometimes do that when saving 100 numbers as a preset/preferences to disk.
    • Jul 15 2013 | 10:08 am
      @ Roman : Simple answer but precisely what I was looking for. Simple, yet elegant. So simple in fact, I sometimes wonder how I can overlook the obvious!
      @Lee : Also precisely what I was looking for. This being my first large project, your input serves as a baseline for expectations.
      @Krisw : that's something I never would have considered. So, my question to you then is why you would do that in a large patch ? Is there some hidden benefit to doing that as opposed to just creating an abstract instead ?
      Just as important as learning to create a nice patch, it's very helpful to have a baseline. Anyone else have anything else they care to add ? This is great !
    • Jul 15 2013 | 11:18 am
      i dont know if it would fit your project , i just thought that instead of placing hundereds of numboxes it would be easier to mimic this through jsui , if its for relaxed manipulation then it would be really useful i believe . you could make dynamic UI that show "things" that are needed and hide the others when unnecessary to keep UX friendly for u as a user . just thoughts edit : of course you can do it in max directly . i just finding a lot of fun doing things through the code
      @Lee would u be able to help me out in my other thread where im struggling with Js and the realm of LOM ? im really stuck :/
    • Jul 15 2013 | 11:59 am
      @Krisw : No problem. It's all good info. Having never done any Jsui stuff I just assume it's ultimately going to be a trade-off between an interface which is dynamically created, and one which is pre-created and simply loaded. Do you find the Jsui to be more efficient for one reason or another ? Are there instances where you would choose one over the other ?
    • Jul 15 2013 | 12:26 pm
      not tried JSUI either myself, isn't it for building graphical UIs?
    • Jul 15 2013 | 1:42 pm
      @Lee Yes, dynamically. If you need flexibility in any particular interface, no doubt this would be a great method. In my particular case though, mine is fixed and always the same. Having said that, I will definitely get into that in time. Great expandability potential.
      @all I've decided to replace all those numboxes with a single multi slider. There, I have my elegant solution. :-)
      How come none of youz guys suggested that !? :-P. (Just kidding. No one can ba all brilliant all of the time. . . .or is there some secret reason everybody's not doing that ?
      I'll be moving on to part 2 of my question before too long.
    • Jul 15 2013 | 1:50 pm
      @Lee yes yes ,its for creating realtime and static graphics and UIs generally .
      @Gleenzone as you can use GLgraphics or Mgraphics its really convinient to start experimenting wit it . i found it really fast performing , also it is not hungry for CPU much more than jitters as far ive tested . also there are PATCH A DAY series that covers possibility .very impressive anyway .
      as a example of my usage .ive written piano roll with all mouse features ,scrolls grids ,ranges , note drags , selections , note durations , positions ,overlapings , almost everything . all that is coded for UI experience inside JSUI . i wouldnt be able to make it in plain max i guess .also i can do it with my aesthetics that fits into my tired eye . but yeah , its complexivity required such consideration anyway . its really worth a look even if it will not fit for you now !
    • Jul 15 2013 | 2:32 pm
      for dynamic interfaces I just show/hide/move things around depending on what I need...
    • Jul 15 2013 | 2:55 pm
      yes yes thats pretty allright :) but with jsui i can go pretty complex . unfortunately i cant draw waveform plots easily ,but mgraphics suppports alpha channel ,so you can blend things together (like waveform object etc),also using pictures is allowed . youve got modifiers for the mouse ,and control buttons right there ,so im really having fun with it . it just depend from taste , i just love to code things . perhaps im making things more complicated that way ,considering how i want to achieve certain goal . its just worth looking at i believe
    • Jul 15 2013 | 3:45 pm
      @Krisw : Nothing ventured, nothing gained. I say, venture forth, and tell us of your journey upon your return. :-)
      I know i will. I have not ventured into those areas, but it's inspiring when I hear others doing such things.