Forums > Javascript

x-y controller jsui example?

Apr 03 2009 | 6:09 pm

Hi everybody!

There’s a long post to follow, but the bottom line is that i want to build a x-y controller (with lcd or jsui) that has more than one ‘dot’ in it. It’d have multiple draggable points and report the position of each. The next step would be intead of having points, having circles whose radius can be changed as well as being moved around. These would live on a square in both cases.

I’ve never used lcd or jsui and I have no idea where to begin with this stuff. I am a fair hand at computer programming in general, tho I only have a little experience at javascript and that was more than 5 years ago. Examples are what I need to build from.

I am still running max 4.6, btw (on windows xp).

a somewhat verbose description of the patch idea follows:

i have this idea for a sort of crossfader thing sort of inspired by vector synthesis. Basically, the idea is to have N sound sources (not just four) where the loudness is controlled by a 2-d oscillator. Imagine a square with points inside it representing the different sound sources. now imagine a dot running around in the square, and the nearer the dot is to a given point, the louder the corresponding sound source is. Now, instead of the sound sources being represented by points, represent them with a circle. the smaller the circle, the closer the dot has to be to make the sound loud, so a really wide circle will basically mean the sound is always on.

So, the interface I want to have is a square with a fixed number of circles in it where I can drag the circles around inside the square, and also drag to make them wider or thinner (i’m guessing the circles have a dot in the center for dragging and the circle around for width control). The scanning dot should be able to be controlled by external commands or dragged around with the mouse.

A much simpler but also useful interface would just have several points that i could move around, where the scanning dot and width would not be displayed or controlled within the interface, but separately with vanilla max interface elements.

Adding/removing sound sources (circles/points) would not be necessary, as this would involve on the fly connection of signals inside max. It might could be done with poly~ or something but i’d be content with just a fixed number of points.

I had the idea just listening to vents and other common noises, where it seems that there are two or more tones where the loudness of one depends on the loudness of the others. Sometimes when one tone appears another goes away, and sometimes the loudness is positively linked.

Getting this to work wihtout the nice interface shouldn’t be too hard, but playability is key. It’s not unlike the mulch metasurface i guess, but automating (as with a randomized lfo) the scanner would be impossible inside mulch so far as I know.


Apr 03 2009 | 7:52 pm

Quite recently Andrew Benson unveiled an external called [nodes] that does pretty much what you are looking for, however it is for mac and max5 only at the moment. Here’s the link just in case you can get on a mac and test it out.

I haven’t used [jsui] in a while but I had a sort of [pictslider] type control working at one point. I’ll see if I can find it and post it here if I think it might be useful to you. Sorry I can’t be of more help.


Apr 04 2009 | 5:15 pm

somebody linked me to this website, , which had this set of nifty patches:

which includes a multi-point x-y controller built on lcd. there’s some javascript in there but not in a jsui object. i like their approach, the js is used to handle programming tasks that’d be cumbersome to do in max… how nice to have functions and variables…

Apr 05 2009 | 5:09 pm


Around the same idea, i did a jsui object just a few days ago (see attachment). As it is my first javascript thing, the code may probably be improved. Please let me know if you do so.
I got another version, with an additional square, that I can post after I clean the code if you are interested.
The help file is max 5, but it works the same under 4.6.


Apr 08 2009 | 1:15 pm


I’m the author of the nifty patches you mention…

I used LCD over JSUI due to speed issues with JSUI, plus I couldn’t get my head around screen-to-world etc, at the time.

I’ve now got the gravity example ported to Jitter, and should really do the same with the others.

You might be interested in a standalone app I just released that also uses the LCD and JS combination.

As you’re on a PC you’ll need the Max 5 runtime installed.

Jun 11 2009 | 8:02 am


I’m having some issues with js lcd combination. I’m making an additive synth that is controlled by a touchscreen. I used to use [function] for he individual adsr shapes for every harmonics, but due to the touchscreen i use i needed to step of of this idea, and recreated a [function]-like js that draws on an lcd. But it seems to be very hard on my macbook pro. I guess it is because the lcd is large (1500×900).

I also use the js within a poly to use just one lcd and turn the drawing function off when ever the harmonic isn’t in focus.

I was wondering if it would be better to address opengl (not within jsui) directly, but don’t know how. Could someone please have a look at the attached patches? the bigscreen patch is just the lcd with some send/receives. the jr_adsr_xy.maxpat is a simple one, but better test the untitled4 that uses the poly.

If I check in the cpu dsp meter it doesn’t move at all though.

best pieter

ps the script is an adaption of the jr_lcd script (thx for that)

Dec 08 2009 | 3:39 am
Mar 17 2012 | 11:18 pm

@pixelmechanic – those js things are great

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

Forums > Javascript