learning structure

muqeem's picture

Hi all,

I am learning structure and cannot get hold on it. So I thought to drop you all a simple composition (attached). I wanted to trigger these numbers one after another on a signal. I am sure using structure, which I am trying to learn, would do this. Please help, if possible.

Thanks a lot in advance

Best

PreviewAttachmentSize
For Kineme .qtz8.4 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

jersmi's picture
Re: learning structure

Quickly, I'm sure better advice is coming. First you need to create the structure. The members of the structure would be your numbers. There are different ways to create a structure, likely choices would be Kineme Struct Maker (or Named Struct Maker) or Javascript. After you create the structure each member will have an index (integer) and/or key (name/string) associated with it. Then, for example, you could use your signal with a counter connected to the index port of a Structure Index Member patch to cycle through the numbers.

The following very simple javascript would output a structure:

_struct = []
function (__structure string) main ()
{
   var result = new Object();
   _struct[0]="One";
   _struct[1]="Two";
   _struct[2]="Three";
   _struct[3]="Four";
   result.string = _struct;
   return result;
}

If you paste this into a javascript patch, then connect the patch to a Structure Index Member patch and connect that to Image with String, that should get you going. Then you can hover over the js output port to see the structure.

PreviewAttachmentSize
Screen shot 2011-12-04 at 3.26.50 PM.jpg
Screen shot 2011-12-04 at 3.26.50 PM.jpg13.82 KB

jstrecker's picture
Re: learning structure

Here's a sample composition. Basically what @jersmi described. Requires DataTools for the Struct Maker patch.

PreviewAttachmentSize
structure countup.qtz5.89 KB

jersmi's picture
Re: learning structure

And, come to think of it, if I was making this for myself I'd likely use an Interpolation patch instead of a Counter. This demo includes a macro to further break down the structure of words into structures of individual letters. Hope this helps.

PreviewAttachmentSize
structure countup2.qtz12.5 KB

muqeem's picture
Re: learning structure

Hi jersmi and jstrecker,

Thank you so much for providing me this learning opportunity, let me play with these.

best

gtoledo3's picture
Re: learning structure

Also, there's a built in Demultiplexer patch (go to setting, switch to Boolean, and ask for a reset value) for turning macros off/on if you wish. (Not to take away from the js learning...).