Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

save multiline text in preset

For general discussion related FlowStone

save multiline text in preset

Postby gvalletto » Sat Sep 09, 2017 9:33 pm

Hi all,
I want to save multiline text in preset, for example:

hello,
how are You,
I´m Gustavo


Whether I use the typical Preset Manager to save that text and then I load it on another preset, I will view only:

hello,


... although the whole text is saved in the preset text file. I saw that the cause is that the syntax of the preset files implies that the usage of Carriage Return/Line Feed is interpreted as "end of preset".
Here is attached a scheme.
save multiline text in preset.fsm
(31.35 KiB) Downloaded 1024 times

Any idea to solve it?
User avatar
gvalletto
 
Posts: 117
Joined: Fri Jul 09, 2010 10:15 pm
Location: Argentina

Re: save multiline text in preset

Postby tulamide » Sat Sep 09, 2017 11:45 pm

The VST preset definition doesn't allow texts to be stored. You can have a string of 255 ASCII characters, that's all. So the only way to deal with it is to store the (preferably relative) path to a text file and then load the text from that file after the preset is loaded.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: save multiline text in preset

Postby Spogg » Sun Sep 10, 2017 9:58 am

Yes indeed! You can’t have a carriage return (new line).

The reason is the way FS stores the preset text string in the preset text file. If you open the preset in notepad you’ll see the carriage return causes the string to be saved with the text after the CR on a new line. Then when you try to reload it, the text file is parsed and the text on the new line is interpreted as a new preset parameter.

It might be possible for someone with excellent Ruby skills to substitute the text string with an allowed character (for the CR) then replace it when loaded, to re-insert the carriage return.

Now, if only we knew somebody who was good with Ruby… ;)

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: save multiline text in preset

Postby gvalletto » Mon Sep 11, 2017 12:55 pm

Spogg wrote:Yes indeed! You can’t have a carriage return (new line).

The reason is the way FS stores the preset text string in the preset text file. If you open the preset in notepad you’ll see the carriage return causes the string to be saved with the text after the CR on a new line. Then when you try to reload it, the text file is parsed and the text on the new line is interpreted as a new preset parameter.

It might be possible for someone with excellent Ruby skills to substitute the text string with an allowed character (for the CR) then replace it when loaded, to re-insert the carriage return.

Now, if only we knew somebody who was good with Ruby… ;)

Cheers

Spogg


Hi Spogg!
Yes, I have tried using the primitives "find" and "replace" but these only work with the first character found. In that case I can only use 1 carriage return ...
User avatar
gvalletto
 
Posts: 117
Joined: Fri Jul 09, 2010 10:15 pm
Location: Argentina

Re: save multiline text in preset

Postby gvalletto » Mon Sep 11, 2017 1:05 pm

tulamide wrote:The VST preset definition doesn't allow texts to be stored. You can have a string of 255 ASCII characters, that's all. So the only way to deal with it is to store the (preferably relative) path to a text file and then load the text from that file after the preset is loaded.


Hi Tulamide,
I already made a scheme that uses separated text files, but I don´t like it because it is too much complex. A lot of primitives (I am not use Ruby), and it is more complex whether I save/load banks or when I implement the "copy-paste" feature to the Preset Manager...
it would be very simple and solid to replace characters as Spogg says, but I do not find a method for a multiple replacement, that is, throughout the text, not just the first character found.
User avatar
gvalletto
 
Posts: 117
Joined: Fri Jul 09, 2010 10:15 pm
Location: Argentina

Re: save multiline text in preset

Postby tulamide » Mon Sep 11, 2017 8:13 pm

It is not as easy as you think. The preset format only allows for a C-string. A string is not a text. It is a chain of 255 human-readable characters terminated by a NULL byte. No control chars are possible in such a string, not only CR or NL, but also TAB, print and others.

The only way to fake a text into a string therefore is to remove all control chars. Which then ends in the issue you described (which is that they are interpreted if not removed). Another possibility would be to use a human-readable char as a NL indicator, but that would reduce the usable number of chars for the text. For example, if you'd use a space " " as indicator, you couldn't write normal sentences, butonlysuchsnakesofchars. Also, the text is not allowed to exceed the 255 chars limit. That makes them short notices at most (less than 2 Tweets on Twitter). I really think the external text file solution is the best.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: save multiline text in preset

Postby Youlean » Mon Sep 11, 2017 10:18 pm

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...
Youlean
 
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: save multiline text in preset

Postby Spogg » Tue Sep 12, 2017 7:46 am

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...


I also thought about that. No, really!! :lol:

Arrays in presets can be HUGE, like every wavetable entry for an oscillator for example. So it would be a matter of conversion both ways from and to ASCII.
Sounds like a task for Ruby...

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: save multiline text in preset

Postby tulamide » Tue Sep 12, 2017 7:50 am

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.

As I said, external text files are the only serious option. And by automating the saving and loading whenever a preset is saved/loaded, there isn't really a drawback.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: save multiline text in preset

Postby adamszabo » Tue Sep 12, 2017 12:24 pm

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
Attachments
preset text.fsm
(7.07 KiB) Downloaded 991 times
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 57 guests