SynthMaker

Automatic Array read-out problem

Archive · 2011 14 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

Skinperforator ·

Hi, first to say: I'm very new to SynthMaker. Here's my problem:

I have managed to read out a text file wich has two associated values per line (x;y). I do have all of them now seperated in an array, which I now want to split into two arrays A1(x) and A2(y). I built the following patcher:

The inputs are the array with the values alternating, a trigger coming frome the changing of this array and the associated number of values in the array. The problem is, that once the trigger is sent the recursive procedure in the end is freezing allthough I inserted the Trigger Switch. Will it work in the end?

infuzion ·

Welcome to SM Skinperforator! OSM please?

DigitalWhiteByte ·

an example of text line?

oddson ·

Looks like you're making it more complicated than required...

The OSM instead of a low-res screen shot would definitely help...

If you mean you have a two dimensional array -- in the form of a block of text such that each line represents two entries with each value separated by a semi-colon -- that you then want to split into two, one dimensional arrays; it should be pretty easy to achieve if you don't mind a green-loop doing the work (which can be a bit slow but for most purposes is fine).

I'll try to post a solution for this interpretation of your problem shortly.

oddson ·

Here's a possible solution:

oddson ·

Skinperforator wrote: ...I do have all of them now seperated in an array, which I now want to split into two arrays A1(x) and A2(y)...

If you already have a single array with x1,y1,x2,y2,x3,y3,...,xn,yn then there is an easy fix for that too.

Skinperforator ·

Hi,

thanks for your replies! I tried your solutions oddson and it works. I adapted the second one wo work with my string array and now I have the two arrays. 😀 I didn't know about this loop thing.

One question: when you say it's a bit slow. How is it exactly? If I want to use the end-product as VST, will there be a lot of delay?

oddson ·

Skinperforator wrote: when you say it's a bit slow. How is it exactly? If I want to use the end-product as VST, will there be a lot of delay?

If you have HUGE arrays the loop can be a bit slow (although I'm not sure in the recent versions of the application how slow).

I know of this mostly from doing loops with tens of thousands of data points that include complex maths (exponents etc. with the green-data components).

Make sure nothing is connected to a view module while the loop is running. The worst results are when you're redrawing the screen with each iteration... then even modest size loops will crawl.

Skinperforator ·

Another question: is the sample and hold component really needed, if the input is already a full array? Thanks in advance!

Edit: Also I don't really understand how the divide N/2 delivers the right indexes for the resulting arrays...

oddson ·

Skinperforator wrote: Another question: is the sample and hold component really needed, if the input is already a full array?...

I'm not at my SynthMaker machine right now so I can't see where I've used a S&H but I sometimes use them to get an explicit update instead of trusting it will work without it. So it may well not be essential.

Skinperforator wrote: Edit: Also I don't really understand how the divide N/2 delivers the right indexes for the resulting arrays...

If the data goes a0,b0,a1,b1,a2,b2,...,... with N resulting entries then for the two component vectors the the zero based indexes will map as follows

0 -> a0 1 -> b0 2 -> a1 3 -> b1 4 -> a2 5 -> b2 ...

If you do an integer divide by 2 you'll see this matchs as the remainders in the odd numbers are droped...

0 - 0 1 - 0 2 - 1 3 - 1 4 - 2 5 - 2 ....

DigitalWhiteByte ·

This is another example, using the primitive custom parser

oddson ·

Skinperforator wrote: I don't really understand how the divide N/2 delivers the right indexes

oddson wrote: If you do an integer divide by 2 you'll see this matchs as the remainders in the odd numbers are droped...

Oh... the modulus divide will return 1 (the remainder of dividing by two) if the value is odd and therefore whether it belongs in the second array... (by controlling the mutiplexer).

Skinperforator wrote: is the sample and hold component really needed

Not really... in this case it's just there to convert the string data into a float array... if it's not a float array connecting to an integer primitive will not give you the size and the rest of the module depends on that.

DigitalWhiteByte wrote: This is another example, using the primitive custom parser

Cool... I taught myself the parser components just for completeness (and to write up a bit of a 'user guide' in the WIKI) but I don't reach for it first thing to solve a small problem like this.

BTW - any idea when semi-colon wouldn't work as an explicit match and made you resort to a range match?

Skinperforator ·

Thanks a lot, now I understood! 😀

DigitalWhiteByte ·

oddson wrote: BTW - any idea when semi-colon wouldn't work as an explicit match and made you resort to a range match?

seems that the primitive Rule String, accepts only a few punctuation characters. but usually I prefer to always use the primitive Rule Range.

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.