View Single Post
Old 01-30-2019, 07:42 AM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,477
Default

To send 4 random bytes you can just use 5 Midi bytes with bit 7 = 0. This would be slightly more efficient than sending 8 bytes with four relevant bits each.

But in fact I would not try to transfer some kind of binary float format via Midi. Regarding OSC the byte order and coding of float is predefined, and hence OSCBot will adhere to it. But the coding of the (floating point) variables used by EEL is not defined, and hence any assumption would be erroneous, and I suppose EEL can't "construct" binary floats at all. .

That is why I would use integer (e.g. your floating value multipied by 1024 or something like this (resulting in 20 bits) . Esay but not perfectly efficient would be transferring 5 bytes with 4 bits each and in OSCIIBot just recreate that integer by adding and multiplying by 16, and finally divide by 1024 (remember, in EEL, any variable is a floating point). Now you can send this value via OSC by the standard means of OSCIIBot.

Slightly more efficient and more exact: multiply by 262144, resulting in 28 bits that can be transferred in four Midi bytes .

-Michael

Last edited by mschnell; 02-03-2019 at 11:30 PM.
mschnell is offline   Reply With Quote