and send some data from setup.js like: Bela.data.sendBuffer(0, 'float', [0, 1]);
Received buffer ID 0 is out of range. I tried to create an array in PD
I know you'll hate this, but there is something wrong here : https://learn.bela.io/tutorials/pure-data/communication/controlling-bela-from-a-gui/
This part won't work:
In sketch.js:
Bela.data.sendBuffer(0, 'float', [0, 1, 2])
Bela.data.sendBuffer(0, 'float', [100, 101, 102])
This will result in arrays named a and b in Pd which contain: a: [ 0, 1, 2] b: [100, 101, 102].
No, it doesn't: you're sending the data to the same array (ID='0'), so b will be empty.
- Edited
Yeah that makes sense to me, so it was probably a typo. When you fix that, does everything else work as expected?
Typo aside, I could actually manage to solve my problem:
1. In addition to [new array flow] to have to set the size of this array (using 'put array' from the menu and setting the size)
2. In order to access any element in that array, you need something like this:
(If you think, this is too complicated and there is a more straight-forward way to do this, please advise)
DragonSF 1. In addition to [new array flow] to have to set the size of this array (using 'put array' from the menu and setting the size)
Yes, the size has to be set in Pd. I think we could use int libpd_resize_array(const char *name, long size)
to do it from the C++ libpd backend, but that wouldn't be RT-safe.
You can use [array get]
to get a range of values as a list