Welcome to %s forums

BrainModular Users Forum

Login Register

save comma text to file, edit and read it !

I need help on a Patch
User avatar
oli_lab
Member
Posts: 1301
Location: Brittany, France
Contact:

Unread post by oli_lab » 02 Nov 2014, 17:15

I'm building an interactive patch were someone can choose from a soundbank, choose to fiddle with some parameters, and then listen to the result.

to do that, I have to attach some metadatas to each files, such as markers, the range of the pitch values, filter values that make the particular sound interesting...

I managed to do that with a array memorizer and a preset manager... but it is not as professionnal as it should be... and a pain to edit.

What I'd like to do is a spreadsheet (.CVS) that can be saved as a file and be externally edited from a text editor, the readback from Usine to load a file (from long file name), and taking into account the metadatas.

would anyone has an idea ?

thanx

Olivar
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

User avatar
oli_lab
Member
Posts: 1301
Location: Brittany, France
Contact:

Unread post by oli_lab » 03 Nov 2014, 00:22

I managed something, not a CVS but many text files...
used the "write text example" and made a "text file reader"

<code>
/////////////////////////
// write text File
/////////////////////////
// declaration


const filenameDefault = 'c:speak.txt';
var fname,input : Tparameter;
var st : TStringList;

// save
procedure SaveToTextFile;
begin
st.create;
st.add(GetStringValue(input));
st.SaveToFile(GetStringValue(fname));
st.free;
end;

// Callback
procedure callBack(n:integer);
begin
SaveToTextFile;
end;

// initialisation : create parameters
procedure init;
var i : integer;
begin

Input := CreateParam('in',ptTextField);
SetIsOutPut(Input,false);
fname := CreateParam('file name',ptTextField);
SetStringValue(fname,filenameDefault);
SetIsOutPut(fname,false);
end;


</code>

<code>
//////////////////////////
// Read text File example
/////////////////////////
// declaration


const filenameDefault = 'c:speak.txt';
var fname,textOut : Tparameter;


var st : TStringList;
var data : array of single;

// initialisation : create parameters
procedure init;
var i : integer;
begin
// initialisation : create parameters

textOut := CreateParam('out',ptTextField);
SetIsInPut(textOut,false);
fname := CreateParam('file name',ptTextField);
SetStringValue(fname,filenameDefault);
SetIsOutPut(fname,false);
end;

// read
procedure ReadTextFile;
begin
//read the previously saved file
st.create;
st.clear;
st.loadfromFile(GetStringValue(fname));
SetStringValue(textOut,st.GetStrings(0));
st.free;
end;

// Callback
procedure callBack(n:integer);
begin
ReadTextFile;
end;


</code>
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

23fx23
Member
Posts: 2548

Unread post by 23fx23 » 04 Nov 2014, 12:23

nice!, thx 4 sharing

User avatar
oli_lab
Member
Posts: 1301
Location: Brittany, France
Contact:

Unread post by oli_lab » 04 Nov 2014, 20:04

well, I'm getting somewhere :)

tell me what you think !

http://www.sensomusic.com/forums/upload ... datas1.pat
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

Post Reply