Preset array of integer changes to floats on project reload
Preset array of integer changes to floats on project reload
Greetings,
I'm trying to use an array of 256 integers in an expression for preset storing but when the project is reloaded my stored array contains floats.
Is there any way to declare/fix data type so that this conversion does not take place?
The numbers are 32bit, when the float conversion happens the number is truncated so I cannot floor to get a result.
I think using 16 bit numbers will solve my problem but will require some reworking of my project so is a last resort.
I'm getting a feeling of deja vu from when I owned the original Lemur all those years ago. The extra horse power from the ipad and stabilized scripting is a great improvement but its a shame the data handling limits and no preset system are still a major pita.
That said it has forced me to learn some good techniques to work around these limitations which I will share as soon as this last niggle has been solved.
I'm trying to use an array of 256 integers in an expression for preset storing but when the project is reloaded my stored array contains floats.
Is there any way to declare/fix data type so that this conversion does not take place?
The numbers are 32bit, when the float conversion happens the number is truncated so I cannot floor to get a result.
I think using 16 bit numbers will solve my problem but will require some reworking of my project so is a last resort.
I'm getting a feeling of deja vu from when I owned the original Lemur all those years ago. The extra horse power from the ipad and stabilized scripting is a great improvement but its a shame the data handling limits and no preset system are still a major pita.
That said it has forced me to learn some good techniques to work around these limitations which I will share as soon as this last niggle has been solved.
Re: Preset array of integer changes to floats on project rel
Hi
Had a bit of a look and there may be some oddness going on, but also some ways around it all ....
I don't think there is a way to force type - an array can be anything, defining as ints does not force it to remain as such . . .
Forcing what gets stored to it by only sending it ints is the way to go
Using the floor() function at the right spots should keep things how you need it . .
Maybe send a simplified version of the project so we can see your logic ...
MM
Had a bit of a look and there may be some oddness going on, but also some ways around it all ....
I don't think there is a way to force type - an array can be anything, defining as ints does not force it to remain as such . . .
Forcing what gets stored to it by only sending it ints is the way to go
Using the floor() function at the right spots should keep things how you need it . .
Maybe send a simplified version of the project so we can see your logic ...
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Preset array of integer changes to floats on project rel
Also, I wonder if perhaps the OP has seen this?:
http://twistedtools.com/blog/morph-board-for-lemur/
http://twistedtools.com/blog/morph-board-for-lemur/
Re: Preset array of integer changes to floats on project rel
Thanks for your replies a simple test is to make a single pad with script storing to global expression test, then save your project and reload.
test = {536870915,47457457};
On project reload test will be
{536870880.000,47457456.000}
I'm not sure how floor will help with this as I fear data type is not stored and default on recall is float also the extra .000 is busting a limit.
test = {536870915,47457457};
On project reload test will be
{536870880.000,47457456.000}
I'm not sure how floor will help with this as I fear data type is not stored and default on recall is float also the extra .000 is busting a limit.
- Attachments
-
- storeTest.jzml
- (3.43 KiB) Downloaded 75 times
-
- Regular
- Posts: 315
- Joined: 02 Nov 2013 11:19
Re: Preset array of integer changes to floats on project rel
out of morbid curiosity, what is the largest number you can use that doesn't get truncated? I see references to 32 bit numerical precision in the manual, but I didn't see a max value mentioned anywhere. I know it is at least 8,355,711 since that is the largest RGB color value...Mr Bit wrote:Greetings,
I'm trying to use an array of 256 integers in an expression for preset storing but when the project is reloaded my stored array contains floats.
Is there any way to declare/fix data type so that this conversion does not take place?
The numbers are 32bit, when the float conversion happens the number is truncated so I cannot floor to get a result.
I think using 16 bit numbers will solve my problem but will require some reworking of my project so is a last resort.
I'm getting a feeling of deja vu from when I owned the original Lemur all those years ago. The extra horse power from the ipad and stabilized scripting is a great improvement but its a shame the data handling limits and no preset system are still a major pita.
That said it has forced me to learn some good techniques to work around these limitations which I will share as soon as this last niggle has been solved.
BTW - I've had arrays I declared end up mixed integer and float when I looked in the .jzml file. I also see switch X values stored as 1.000000 when it really can only be 0 or 1.
Re: Preset array of integer changes to floats on project rel
It seems to work up to 24bit.If you imagine 32 switches representing our 32 bits with switch 1 and 24 on this is where its breaks,the number generated with switch 1 and 23 is stored and recalled properly(aside from being converted to a float)oldgearguy wrote:out of morbid curiosity, what is the largest number you can use that doesn't get truncated? I see references to 32 bit numerical precision in the manual, but I didn't see a max value mentioned anywhere. I know it is at least 8,355,711 since that is the largest RGB color value...Mr Bit wrote:Greetings,
I'm trying to use an array of 256 integers in an expression for preset storing but when the project is reloaded my stored array contains floats.
Is there any way to declare/fix data type so that this conversion does not take place?
The numbers are 32bit, when the float conversion happens the number is truncated so I cannot floor to get a result.
I think using 16 bit numbers will solve my problem but will require some reworking of my project so is a last resort.
I'm getting a feeling of deja vu from when I owned the original Lemur all those years ago. The extra horse power from the ipad and stabilized scripting is a great improvement but its a shame the data handling limits and no preset system are still a major pita.
That said it has forced me to learn some good techniques to work around these limitations which I will share as soon as this last niggle has been solved.
BTW - I've had arrays I declared end up mixed integer and float when I looked in the .jzml file. I also see switch X values stored as 1.000000 when it really can only be 0 or 1.
Yes I've seen the mixed INT and float thing too!
Re: Preset array of integer changes to floats on project rel
Hi
floor() will convert the floating point number to the next lower int . . .
There is no 'data type not stored' or 'default recall as float' . . .
There may be a bug or two that is affecting what you are seeing . . .
Try using an onLoad script at project level with the same code . . .
So - use floor() in your scripts to set values as ints, or use floor() in the Monitor to see it as an int
Pretty sure its signed 32 bit ints so range is −2,147,483,648 to 2,147,483,647
Does go beyond this but numbers get folded/flipped
floor() will convert the floating point number to the next lower int . . .
There is no 'data type not stored' or 'default recall as float' . . .
There may be a bug or two that is affecting what you are seeing . . .
Try using an onLoad script at project level with the same code . . .
So - use floor() in your scripts to set values as ints, or use floor() in the Monitor to see it as an int
Pretty sure its signed 32 bit ints so range is −2,147,483,648 to 2,147,483,647
Does go beyond this but numbers get folded/flipped
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Preset array of integer changes to floats on project rel
I've rewritten my save routine to work with 16 bit chunks, 32x32 conway's game of life is now alive!
I'm just polishing it up before I make it available.
Bit
I'm just polishing it up before I make it available.
Bit
-
- Newbie
- Posts: 7
- Joined: 29 Apr 2014 16:36
Re: Preset array of integer changes to floats on project rel
Hi,
Is there a solution to the OP problem? I am suffering the same issue. Using MrBit's example project...
test = {floor(0x02ffffff),floor(47457457)};
When executed, the monitor correctly displays {50331647, 47457457 }
However after a project save and reload we get this from the monitor;
{50331648.000, 47457456.000}
If the values are dynamically created and stored with the project rather than hard coded, can someone explain how using a floor will solve this problem? The value is being truncated at some point, either on the save project or the reload. Using onLoad doesn't help as the value is already corrupt, sure I can floor the value but that just gives me an integer containing the wrong value. At the point of project save we can clearly see the values are integers so should be stored as such.
I cant see how 'Macciza's suggestion of using floor's addresses this issue.
In effect this limits the practical max size of an integer to 24 bits. The problem is particularly nasty as it all works fine until you reload your project.
Macciza:"Pretty sure its signed 32 bit ints so range is −2,147,483,648 to 2,147,483,647, Does go beyond this but numbers get folded/flipped"
So yes internally during script execution this is the case, but practically one cant use this full range as the data is lost on a project save/load.
Any solutions to this fault?
Is there a solution to the OP problem? I am suffering the same issue. Using MrBit's example project...
test = {floor(0x02ffffff),floor(47457457)};
When executed, the monitor correctly displays {50331647, 47457457 }
However after a project save and reload we get this from the monitor;
{50331648.000, 47457456.000}
If the values are dynamically created and stored with the project rather than hard coded, can someone explain how using a floor will solve this problem? The value is being truncated at some point, either on the save project or the reload. Using onLoad doesn't help as the value is already corrupt, sure I can floor the value but that just gives me an integer containing the wrong value. At the point of project save we can clearly see the values are integers so should be stored as such.
I cant see how 'Macciza's suggestion of using floor's addresses this issue.
In effect this limits the practical max size of an integer to 24 bits. The problem is particularly nasty as it all works fine until you reload your project.
Macciza:"Pretty sure its signed 32 bit ints so range is −2,147,483,648 to 2,147,483,647, Does go beyond this but numbers get folded/flipped"
So yes internally during script execution this is the case, but practically one cant use this full range as the data is lost on a project save/load.
Any solutions to this fault?