Forums > MaxMSP

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

July 14, 2013 | 2: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 1×16 matrixctrl objects into one 10×16 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 ?


July 14, 2013 | 4: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].

-110


July 14, 2013 | 5:51 pm

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 ?


July 15, 2013 | 12: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 .



Lee
July 15, 2013 | 1: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? :)


July 15, 2013 | 1: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.

-110


July 15, 2013 | 3: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 !


July 15, 2013 | 4:18 am

@Gleenzone

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 :/


July 15, 2013 | 4: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 ?



Lee
July 15, 2013 | 5:26 am

not tried JSUI either myself, isn’t it for building graphical UIs?


July 15, 2013 | 6:42 am

@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.


July 15, 2013 | 6:50 am

@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 !



Lee
July 15, 2013 | 7:32 am

for dynamic interfaces I just show/hide/move things around depending on what I need…


July 15, 2013 | 7:55 am

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


July 15, 2013 | 8:45 am

@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.


Viewing 15 posts - 1 through 15 (of 15 total)