Page 2 of 4

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 12:35 pm
by tulamide
adamszabo wrote:The easiest and most simplest solution is to convert your multiline string to hexadecimal then convert it back. The problem is that the string preset only holds 255 (i think) characters and you can only write a small description, but it does the job

That's a cool idea! Also, it stays within the VST definitions. And yes, as I said earlier in another post, there still is the 255 char limit. You have to take care of it, or else the text will be cut.

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 12:36 pm
by Spogg
adamszabo wrote:The easiest and most simplest solution is to convert your multiline string to hexadecimal then convert it back. The problem is that the string preset only holds 255 (i think) characters and you can only write a small description, but it does the job


Excellent Adam! Straight into my toolbox.

Simple and effective solution and using none of that magic Ruby stuff! ;)

255 characters should be sufficient for notes and bits of help text I would say.

Thanks for sharing!

Spogg

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 5:58 pm
by RJHollins
Thanks Adam .... works nice !
8-)

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 7:47 pm
by FlowStoner
Base64 encoding
Code: Select all
str = ["\x31"*186].pack('m')
watch 'str', s = str.unpack('m').first
watch 'size', [str.size, s.size]


you can store max 186 char ascii, included special control.

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 9:33 pm
by gvalletto
Thaks Adam! great work with simple resources.

I attempted to double the number of characters in this new attached scheme.
This scheme stores the text in 2 presets, since 500 characters it is enough for my needs.
ThereĀ“s 2 box. The idea is to accommodate them graphically so they look like a single box.
If you type in the upper box, when it reaches 255 characters, the cursor will automatically switch to the box below. This system works fine, but if after writing in the box below I click on the upper one, it allows me to write more than 255 characters (obviously them will be not saved correctly). I have tried several things to limit text input to a maximum of 255 characters but I have not succeeded. any idea?

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 9:49 pm
by tulamide
Had just a quick look, since I'm on something else currently, but the issue is the bool to trigger prim. This fires one trigger only when the boolean changes to true. Since on re-entering the boolean still is true, no trigger is sent this time. You might want to find a way to "reset" the comparison prim to false on leave (which is what I will also try later), so that the prim can send a trigger again on re-entering.

Re: save multiline text in preset

PostPosted: Tue Sep 12, 2017 11:14 pm
by adamszabo
Also, right now you are counting the actual strings before they get converted into hex and thats not accurate. You need to put the length after the String to Hex, because thats the actual values that go into the preset text.

Re: save multiline text in preset

PostPosted: Wed Sep 13, 2017 3:20 pm
by gvalletto
adamszabo wrote:Also, right now you are counting the actual strings before they get converted into hex and thats not accurate. You need to put the length after the String to Hex, because thats the actual values that go into the preset text.

Please see this image. There is the reason by which I connected the counter before the conversion: I prefer to see the real quantity of chars.
In addition, although 255 characters of text mean 510 characters in hexadecimal, the presets work fine, which caught my attention ...

Re: save multiline text in preset

PostPosted: Wed Sep 13, 2017 5:00 pm
by Youlean
tulamide wrote:
Youlean wrote:Can you save array in preset? (Haven't used a Flowstone for a while). If so, just cast every char to int and save is as int array...
That also is not a solution. While you can indeed save an array in a preset, it again is limited. This time to a single precision float and only in the range 0-1. So, even if you'd convert the ints to floats in that range, due to the imprecise single precision floats it would come to decryption errors.

Not true. You only need to store 256 different values in range 0-1 which is enough precise for float.

Re: save multiline text in preset

PostPosted: Wed Sep 13, 2017 9:32 pm
by gvalletto
FlowStoner wrote:Base64 encoding
Code: Select all
str = ["\x31"*186].pack('m')
watch 'str', s = str.unpack('m').first
watch 'size', [str.size, s.size]


you can store max 186 char ascii, included special control.


Hi Flowstoner, excuse my ignorance, can You explain about that? I just use Flowstone DSP code...