Welcome to %s forums

BrainModular Users Forum

Login Register

Basic array question

I need help on a Patch
Post Reply
Gilsornette
Member
Posts: 280
Contact:

Basic array question

Unread post by Gilsornette » 11 Nov 2019, 22:20

Hello,
I'm working on a patch in which several values are received via a data bus ; I'd like to store them in an array. What is the easiest way? I've seen there is an Unpack Array module, is there a kind of Pack Array Module?
Thank you

User avatar
x.iso
Member
Posts: 565
Location: RU, Saint-Petersburg
Contact:

Unread post by x.iso » 12 Nov 2019, 10:28

Data flow also supports arrays (at data rate), so you can send array into Data bus.
join Hollyhock Usine Discord server: https://discord.gg/EdJarnE

Gilsornette
Member
Posts: 280
Contact:

Unread post by Gilsornette » 12 Nov 2019, 10:46

In this case I'm sending some values (Racks Ids) at different moments and I just need to "pack" , to store them in an array. The fact they are sent via data bus is not important.
My problem is: how do I create an array with several separate values (int or floats...). I'm not sure to be clear.

Gilsornette
Member
Posts: 280
Contact:

Unread post by Gilsornette » 12 Nov 2019, 11:09

One more thing. Maybe the fact they are sent through Data bus has its importance. All the values are coming from the same output .

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 12 Nov 2019, 11:19

a store array script module ?

Gilsornette
Member
Posts: 280
Contact:

Unread post by Gilsornette » 12 Nov 2019, 11:48

Isn't it a kind of preset of arrays? In my case it does not work. What I'm looking for is the opposite of the Unpack Module (I guess so).
Another example could be: how to store in (or create) an array with the 10 first values of a fader when moving it?

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 12 Nov 2019, 12:57

Here an idea, don't know if it can work for you

Download

Gilsornette
Member
Posts: 280
Contact:

Unread post by Gilsornette » 12 Nov 2019, 14:29

Yes, it works for me, thank you Yan
But I was hoping there was a single module that can do that. Maybe I could suggest it?

Gilsornette
Member
Posts: 280
Contact:

Unread post by Gilsornette » 12 Nov 2019, 15:49

I made a simple version of your patch and wanted to upload it. But I don't find where, how to upload it...

User avatar
x.iso
Member
Posts: 565
Location: RU, Saint-Petersburg
Contact:

Unread post by x.iso » 12 Nov 2019, 17:00

try full editor with preview, there you can use attachments

also, there is a single module for this, Array queue. it's just that it will store any change at data rate. with Nay's patch it stores at lower 'refresh speed', but even so you can do it simpler way with queue module:
2019-11-12_19-08-43.gif
join Hollyhock Usine Discord server: https://discord.gg/EdJarnE

Gilsornette
Member
Posts: 280
Contact:

Unread post by Gilsornette » 12 Nov 2019, 17:28

Thank you x.iso, that was the module I was looking for

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 12 Nov 2019, 21:12

You're right @x.iso ! :P

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 10 Jan 2020, 04:20

If arrays sent using data busses are sent at 'data rate', what rate are they sent at when you use an array send? Is one faster than the other? more CPU efficient?
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

SylvainT
Site Admin
Posts: 494
Contact:

Unread post by SylvainT » 10 Jan 2020, 10:09

What do you mean by "array send"?
Everything is sent at "data rate" in Usine, even audio wich is sent with arrays sized on "block size".
Arrays are data, so you can use "data busses". Using busses compared to wires will introduced one block size latency, but could be more CPU efficient.

Sylvain

sm_jamieson
Member
Posts: 553
Contact:

Unread post by sm_jamieson » 10 Jan 2020, 15:21

If this is helpful to anyone:

If you send an array event (event size > 1) to a data bus, then whole array will be sent every bloc.
If you send a sequence of events and queue them into an array (like the x.iso patch), each value will take a bloc,
so an array size 8 would take 8 blocs to fill.
If you write User module, you can create sort of custom event formats - an event is just a block of 32 bit words after all.

Also, a text event is just an array with a floating point ascii value in each array position. You can find out by putting a text wire into an array display module.
This is sort of inefficient, since an ascii value is only 8 bits and an event value is 32 bits. However, this makes it more flexible and also
would allow Unicode values in there.
Something to watch out for if you use the SDK: some functions provide a Unicode string rather than an ascii string.

Some other things I have noticed:

Although all events are the same format, the parameter/PIN you send it to can affect the way it is interpreted - which matters
if you make User modules or scripts.
Since events are nominally 32 bit float, if you try to send a large integer value you need to avoid the integer value being converted to
a float (which only has 24 bits of precision), which means some colours will be corrupted.
The way to do this is to use a "Bitwise" parameter, which will leave the bits how you put them into the event.
And in the SDK set the values using an event pointer that can be cast to whatever type you want.

User avatar
x.iso
Member
Posts: 565
Location: RU, Saint-Petersburg
Contact:

Unread post by x.iso » 10 Jan 2020, 17:00

SylvainT wrote:
10 Jan 2020, 10:09
What do you mean by "array send"?
Everything is sent at "data rate" in Usine, even audio wich is sent with arrays sized on "block size".
Arrays are data, so you can use "data busses". Using busses compared to wires will introduced one block size latency, but could be more CPU efficient.

Sylvain
well, all signals sent at data-rate except for audio signals, when sent through appropriate nodes. some modules also have options to enable audio-rate for data modulation.
join Hollyhock Usine Discord server: https://discord.gg/EdJarnE

Post Reply

Who is online

Users browsing this forum: No registered users and 76 guests