Another basic VL question from me…
Thanks DeVLs for the the network nodes in VL.
How do I convert a spread of bytes (like the output of the UDP client node) to a float32?
So far I have :
A spread of a spread of bytes coming out of the (experimental) UDP client node
I’ve got that down to a spread of bytes with a foreach loop
I’ve found the ToFloat32 (System) node but it wants an array of bytes, not the spread I have.
- Looking for a ToArray function, but they only exist for Vectors, not bytes
- Using Set and SetItem to build my own array, but like setslice in vvvv they require an array to already exist with a # of elements to set. I can’t work out how to create that initial array. I can only find the empty array node with 0 elements.
- Using a loop region to build the array but there is no additem function for arrays
I just solved it.
Using GetBytes (float32) you can generate a 4 byte float array and then use some Set (array) to change the bytes to your own values. Will post a screenshot shortly.
OK so this is a laughably bad solution. Here it is just in case anyone else needs it for now. I’m sure something much neater is possible. (I can of course patch it into it’s own node to hide the mess)
I did hope to get it to operate in a loop but I can’t seem to pass the initial byte array into the loop with the accumulator. Not sure why.
this is indeed a bit too complicated. getting the bytes from the spread could be done by GetItem or GetSlice nodes. why did you use the Skip/SplitFirst combination?
anyway, beta35.1 was just released and comes with ToFloat32 [Spread] for that. only thing you have to do is reference the DevLib:
BytesToFloats.vl (7.1 KB)
Ah great. Downloading 35.1 now.
I used skip because I was fixed on thinking about how I dealt with raw and bytes back in vvvv. Still too much vvvv thinking…
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.