Page 1 of 1

float to hex converter

Posted: Sat May 17, 2014 3:44 pm
by KG_is_back
Lately I needed to store a bunch of coefficients with preset manager and I've found out that the floats get rounded to 6 decimal places. That is OK when saving knob positions and bar graphs, but it is very poor when saving coefficients for a filter. This little tool can lossless convert float array to array of hex (string array) and vice versa, which let's you save your parameters with full precision.

I believe this can be dome much faster and easier in ruby...can someone do that too please?

Re: float to hex converter

Posted: Sun May 18, 2014 10:15 am
by Nubeat7
here`s a ruby version

Re: float to hex converter

Posted: Sun May 18, 2014 4:16 pm
by KG_is_back
Thanks Nubeat, this is great! This should be a default way to save floating point numbers in preset manager. Or there should be a boolean input on the preset parameter primitive to switch between classic (decimal) and precise (hex) parameter saving mode. Actually it also takes less space to save the number as 8 symbols rather than 7+ numbers and a decimal dot.

Re: float to hex converter

Posted: Sun May 18, 2014 7:32 pm
by Nubeat7
you`re welcome KG, yes you are right, also when the file gets more cryptic but it isn`t here for change things anyway, it just gets bit morecomplicated when you need to compare or look the preset file for testreasons... but everything which make them smaller is good!

how did you modify the presetmanager to use hex?

Re: float to hex converter

Posted: Sun May 18, 2014 9:18 pm
by KG_is_back
very simple - convert string array to string delimiting with random char (usually I use ? or * as they are rarely used) and save them using "string preset" primitive. extraction works other way around - convert string to string array by separating it at ? or * whichever is the case. ....actually for the float arrays saved as hex, you can simply convert them to string with no delimiter and convert them back by spliting them to 8 long strings.

It is written there that the string must be 255-long at max, but I never noticed any problem even with much longer strings.

Re: float to hex converter

Posted: Sun May 18, 2014 11:18 pm
by Nubeat7
ah okay, so you collect parameters and save it under one presetname (why does longer strings then 255 works too?), but what about automation and parameter names then? would this work too, or is it only good for non automated parameters?

Re: float to hex converter

Posted: Sun May 18, 2014 11:35 pm
by KG_is_back
This might work...

However, you probably don't benefit from lossless precision on automatable parameters

Re: float to hex converter

Posted: Mon May 19, 2014 10:29 am
by Nubeat7
oh, i didn`t know that the parameters will be recognised in the DAW when preset is off and automate is on - thats fine thanks!