Help with Structures and Javascript

0101000101000011's picture

Hello. I'm seeking information/tutorials on using structures and Javascript in QC. Separately and together that is. What are structures, what all can they be used for and how? Same for Javascript. XML MIDI structures? I've used many objects that take structure input, as well as objects that modify a structure, and deconstructed some Javascript to try and understand how it's working. Thats been pretty much my learning curve in QC so far. Figure it out through cause and effect...

One thing that's been on my mind for a while is, somehow making an application for a Monome with QC that would visualize different data sources synced to a tempo. I'm thinking, it's probably possible, but more likely easier programmed in Max. Of which I have very little knowledge. Thus I'm thinking a better knowledge of structures and javascript may yield such an app. I just don't know where to start... I should really just learn Max and build these as M4L devices as they probably won't run as efficient as VDMX plug-ins...

Anyways... Structures and javascript in visual compositions... Rather than control^ Any responses, or perhaps demonstration comps would be greatly appreciated. Thanks.

cwright's picture
Re: Help with Structures and Javascript

(totally awesome handle, btw ;)

Structures are aggregates of other data types -- you can think of them as arrays, or dictionaries. They can contain numbers, strings, images, or other structures.

They can be used for all kinds of things -- they're typically used to represent complex, related data.

You can break them down using Structure Index member and Structure Key Member, or by using JavaScript (which can also build structures). Alternatively, you can use them with OpenCL (those are typically just numerical array-like structures, not complex key/value pair structures).

There should be a fair number of examples laying around here somewhere -- I'm surprised we haven't gather a big set of "here are some intro-level JS in QC compositions" yet, to be honest.

mattgolsen's picture
Re: Help with Structures and Javascript

Cwright, do you think the best place for it would be in the Wiki, or just a thread for it? It seems to be a fairly common question, and something that I've struggled with as well. I have a few different examples that could be posted, maybe with a break down of what each part of the Javascript means.

cwright's picture
Re: Help with Structures and Javascript

wiki might be a good start (since it's not quite a discussion, more like a resource) -- to be honest, anywhere is better than nowhere; stuff can be rearranged later, and linked to when appropriate. (smokris probably has much better design/organization ideas about it than I do).

smokris's picture
Re: Help with Structures and Javascript

I suggest you add them to the composition repository. Under Composition Category there's a "Tutorial" section. Add the "Javascript" Tag.

In the Description section, call out specific Javascript snippets you'd like to elaborate upon. You can use the [javascript] ... [/javascript] markup to do syntax highlighting.