ArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2017-10-25T17:06:04+02:00 https://brainmodular.com/forums/app.php/feed/topic/5922 2017-10-25T17:06:04+02:00 2017-10-25T17:06:04+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38149#p38149 <![CDATA[CSV]]>
A

Statistics: Posted by Ant1 — 25 Oct 2017, 17:06


]]>
2017-10-24T20:22:02+02:00 2017-10-24T20:22:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38144#p38144 <![CDATA[CSV]]> of course works with simple csv , one colonne..( same csv file as before)
Download

Statistics: Posted by nay-seven — 24 Oct 2017, 20:22


]]>
2017-10-24T17:39:37+02:00 2017-10-24T17:39:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38143#p38143 <![CDATA[CSV]]> 1
2
3
...
then i suppose you want convert number values so this script for exemple will read each line, convert text to float and put in an array:

CODE:

//////////////////////////// Read text File lines and outputs float array/////////////////////////// declarationconst filename = 'c&#58;list.txt';  var pArray &#58; Tparameter;   var st   &#58; TStringList;                  //////////////////////////////procedure destroy;  beginst.free;end                                      // initialisation &#58; create parameters      procedure init;var i &#58; integer;begin       pArray &#58;= CreateParam&#40;'Array_out',ptArray&#41;;    setIsInput&#40;pArray,false&#41;;  //////////////////////////////////////////////////////  st.create;  st.clear;                 st.loadfromFile&#40;filename&#41;;  setLength&#40;pArray,st.count&#41;;  for i &#58;= 0 to st.count-1  do begin    setDataArrayValue&#40;pArray,i,strToFloat&#40;st.getstrings&#40;i&#41;&#41;&#41;;  end;  st.free; end;//////////////////////////////////
if you can't get a line by line text easily, but got values separated by commas ie 1,2,3,4,5,6, ect on a single line can use this one:

CODE:

//////////////////////////// Read text File lines and outputs float array/////////////////////////// declarationconst filename = 'c&#58;list.txt';  var pArray &#58; Tparameter;var stA &#58; TStringList;var st   &#58; TStringList;                  //////////////////////////////procedure destroy;  beginst.free;   stA.free; end                                      // initialisation &#58; create parameters      procedure init;var i &#58; integer;begin       pArray &#58;= CreateParam&#40;'Array_out',ptArray&#41;;    setIsInput&#40;pArray,false&#41;;  //////////////////////////////////////////////////////  st.create;  st.clear;     stA.create;  stA.clear;   ///////////////////////////////////  stA.loadfromFile&#40;filename&#41;;            St.SetCommaText&#40;stA.getstrings&#40;0&#41;&#41;;     setLength&#40;pArray,st.count&#41;;  for i &#58;= 0 to st.count-1  do begin    setDataArrayValue&#40;pArray,i,strToFloat&#40;st.getstrings&#40;i&#41;&#41;&#41;;  end;  st.free; end;
Edit : cross post hadn't see nay's one, might work out of the box ;)

Statistics: Posted by 23fx23 — 24 Oct 2017, 17:39


]]>
2017-10-24T17:38:25+02:00 2017-10-24T17:38:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38142#p38142 <![CDATA[CSV]]> place the csv file in your C:
Download

Statistics: Posted by nay-seven — 24 Oct 2017, 17:38


]]>
2017-10-24T16:28:03+02:00 2017-10-24T16:28:03+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38140#p38140 <![CDATA[CSV]]> Statistics: Posted by Ant1 — 24 Oct 2017, 16:28


]]>
2017-10-24T15:52:53+02:00 2017-10-24T15:52:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38138#p38138 <![CDATA[CSV]]> Of course you can do it in C++ in an SDK user module - I use a little CSV function I found, and PUGIXML for XML.

procedure ReadPresetFile(filename : ansiString; inst : integer);
var presetcomma : ansiString;
var presetsList, presetInfList : tstringlist;
var i:integer;
begin
// Read in a preset file and store it in an Instrument record.
// The preset file is a stringlist of commatext

Instruments[inst].filename := filename;

presetsList.create; // whole file - list of presets
presetInfList.create; // preset info being processed

presetsList.LoadFromFile(USINEBASEDIR + '' + PRESETMAPDIR + '' + filename);
setarraylength(Instruments[inst].Presets, presetsList.count);
Instruments[inst].Presetcount := presetsList.count;

for i := 0 to presetsList.count-1 do begin
presetcomma := presetsList.getStrings(i);
presetInfList.setCommaText(presetcomma);

Instruments[inst].Presets.number := StrToInt(presetInfList.getStrings(0));
Instruments[inst].Presets.bank := StrToInt(presetInfList.getStrings(1));
Instruments[inst].Presets.prog := StrToInt(presetInfList.getStrings(2));
Instruments[inst].Presets.name := presetInfList.getStrings(3);
Instruments[inst].Presets.category := presetInfList.getStrings(4);
StoreCategory(Instruments[inst].Categories, Instruments[inst].Presets.category);

presetInfList.clear();
end;

presetsList.free;
presetInfList.free;
end;

Statistics: Posted by sm_jamieson — 24 Oct 2017, 15:52


]]>
2017-10-24T14:27:47+02:00 2017-10-24T14:27:47+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38137#p38137 <![CDATA[CSV]]> Statistics: Posted by 23fx23 — 24 Oct 2017, 14:27


]]>
2017-10-24T09:21:58+02:00 2017-10-24T09:21:58+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38135#p38135 <![CDATA[CSV]]>
Does anyone in the community know whether it is possible to read .csv files in Usine. Or perhaps other text file formats, for the purpose of reading data collection and produce sonifications... thank you !

Ant1

Statistics: Posted by Ant1 — 24 Oct 2017, 09:21


]]>
BrainModular BrainModular Users Forum 2017-10-25T17:06:04+02:00 https://brainmodular.com/forums/app.php/feed/topic/5922 2017-10-25T17:06:04+02:00 2017-10-25T17:06:04+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38149#p38149 <![CDATA[CSV]]>
A

Statistics: Posted by Ant1 — 25 Oct 2017, 17:06


]]>
2017-10-24T20:22:02+02:00 2017-10-24T20:22:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38144#p38144 <![CDATA[CSV]]> of course works with simple csv , one colonne..( same csv file as before)
Download

Statistics: Posted by nay-seven — 24 Oct 2017, 20:22


]]>
2017-10-24T17:39:37+02:00 2017-10-24T17:39:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38143#p38143 <![CDATA[CSV]]> 1
2
3
...
then i suppose you want convert number values so this script for exemple will read each line, convert text to float and put in an array:

CODE:

//////////////////////////// Read text File lines and outputs float array/////////////////////////// declarationconst filename = 'c&#58;list.txt';  var pArray &#58; Tparameter;   var st   &#58; TStringList;                  //////////////////////////////procedure destroy;  beginst.free;end                                      // initialisation &#58; create parameters      procedure init;var i &#58; integer;begin       pArray &#58;= CreateParam&#40;'Array_out',ptArray&#41;;    setIsInput&#40;pArray,false&#41;;  //////////////////////////////////////////////////////  st.create;  st.clear;                 st.loadfromFile&#40;filename&#41;;  setLength&#40;pArray,st.count&#41;;  for i &#58;= 0 to st.count-1  do begin    setDataArrayValue&#40;pArray,i,strToFloat&#40;st.getstrings&#40;i&#41;&#41;&#41;;  end;  st.free; end;//////////////////////////////////
if you can't get a line by line text easily, but got values separated by commas ie 1,2,3,4,5,6, ect on a single line can use this one:

CODE:

//////////////////////////// Read text File lines and outputs float array/////////////////////////// declarationconst filename = 'c&#58;list.txt';  var pArray &#58; Tparameter;var stA &#58; TStringList;var st   &#58; TStringList;                  //////////////////////////////procedure destroy;  beginst.free;   stA.free; end                                      // initialisation &#58; create parameters      procedure init;var i &#58; integer;begin       pArray &#58;= CreateParam&#40;'Array_out',ptArray&#41;;    setIsInput&#40;pArray,false&#41;;  //////////////////////////////////////////////////////  st.create;  st.clear;     stA.create;  stA.clear;   ///////////////////////////////////  stA.loadfromFile&#40;filename&#41;;            St.SetCommaText&#40;stA.getstrings&#40;0&#41;&#41;;     setLength&#40;pArray,st.count&#41;;  for i &#58;= 0 to st.count-1  do begin    setDataArrayValue&#40;pArray,i,strToFloat&#40;st.getstrings&#40;i&#41;&#41;&#41;;  end;  st.free; end;
Edit : cross post hadn't see nay's one, might work out of the box ;)

Statistics: Posted by 23fx23 — 24 Oct 2017, 17:39


]]>
2017-10-24T17:38:25+02:00 2017-10-24T17:38:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38142#p38142 <![CDATA[CSV]]> place the csv file in your C:
Download

Statistics: Posted by nay-seven — 24 Oct 2017, 17:38


]]>
2017-10-24T16:28:03+02:00 2017-10-24T16:28:03+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38140#p38140 <![CDATA[CSV]]> Statistics: Posted by Ant1 — 24 Oct 2017, 16:28


]]>
2017-10-24T15:52:53+02:00 2017-10-24T15:52:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38138#p38138 <![CDATA[CSV]]> Of course you can do it in C++ in an SDK user module - I use a little CSV function I found, and PUGIXML for XML.

procedure ReadPresetFile(filename : ansiString; inst : integer);
var presetcomma : ansiString;
var presetsList, presetInfList : tstringlist;
var i:integer;
begin
// Read in a preset file and store it in an Instrument record.
// The preset file is a stringlist of commatext

Instruments[inst].filename := filename;

presetsList.create; // whole file - list of presets
presetInfList.create; // preset info being processed

presetsList.LoadFromFile(USINEBASEDIR + '' + PRESETMAPDIR + '' + filename);
setarraylength(Instruments[inst].Presets, presetsList.count);
Instruments[inst].Presetcount := presetsList.count;

for i := 0 to presetsList.count-1 do begin
presetcomma := presetsList.getStrings(i);
presetInfList.setCommaText(presetcomma);

Instruments[inst].Presets.number := StrToInt(presetInfList.getStrings(0));
Instruments[inst].Presets.bank := StrToInt(presetInfList.getStrings(1));
Instruments[inst].Presets.prog := StrToInt(presetInfList.getStrings(2));
Instruments[inst].Presets.name := presetInfList.getStrings(3);
Instruments[inst].Presets.category := presetInfList.getStrings(4);
StoreCategory(Instruments[inst].Categories, Instruments[inst].Presets.category);

presetInfList.clear();
end;

presetsList.free;
presetInfList.free;
end;

Statistics: Posted by sm_jamieson — 24 Oct 2017, 15:52


]]>
2017-10-24T14:27:47+02:00 2017-10-24T14:27:47+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38137#p38137 <![CDATA[CSV]]> Statistics: Posted by 23fx23 — 24 Oct 2017, 14:27


]]>
2017-10-24T09:21:58+02:00 2017-10-24T09:21:58+02:00 https://brainmodular.com/forums/viewtopic.php?t=5922&p=38135#p38135 <![CDATA[CSV]]>
Does anyone in the community know whether it is possible to read .csv files in Usine. Or perhaps other text file formats, for the purpose of reading data collection and produce sonifications... thank you !

Ant1

Statistics: Posted by Ant1 — 24 Oct 2017, 09:21


]]>