One of my modules stores an array of float to the patchfile. Currently the size of the array is limited to 96000 but this is quite a random number and I want to loose it eventually.
The module saves only used array cells to JSON and I’ve implemented a super stupid compression but the patchfile can get quite big, especially when using more instances of my module.
The question: Is it a good idea to convert the array of floats to an array of byte to avoid the overhead involved with JSON? I’ve seen trivial solutions using an union:
union Float {
float m_float;
uint8_t m_bytes[sizeof(float)];
};
I don’t mind implementing it, I’m just worried about any platform specific problems. Will the patchfile still be useable on all supported platforms of Rack?
I have only little knowledge about platform-independent development but I know these things can be quite a pain sometimes.
There is no good way to store 100k values in a patch. So you should avoid the problem and use a much smaller sample rate to store your signal. 30-60 Hz would be enough.
Currently its default setting is to store each 128th sample, so 375Hz at 48kHz. I guess I will leave it this way and adjust the default setting as most users won’t care anyway.
Besides that, I just noticed I can’t do it this way because it’s samplerate dependent. Bugfixing-time…