ArrayArrayArrayArrayArrayArrayArrayArray
BrainModularBrainModular Users Forum2017-10-25T17:06:04+02:00https://brainmodular.com/forums/app.php/feed/topic/59222017-10-25T17:06:04+02:002017-10-25T17:06:04+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38149#p38149 A
]]>2017-10-24T20:22:02+02:002017-10-24T20:22:02+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38144#p38144of 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:002017-10-24T17:39:37+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38143#p381431 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:list.txt'; var pArray : Tparameter; var st : TStringList; //////////////////////////////procedure destroy; beginst.free;end // initialisation : create parameters procedure init;var i : integer;begin pArray := CreateParam('Array_out',ptArray); setIsInput(pArray,false); ////////////////////////////////////////////////////// st.create; st.clear; st.loadfromFile(filename); setLength(pArray,st.count); for i := 0 to st.count-1 do begin setDataArrayValue(pArray,i,strToFloat(st.getstrings(i))); 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:list.txt'; var pArray : Tparameter;var stA : TStringList;var st : TStringList; //////////////////////////////procedure destroy; beginst.free; stA.free; end // initialisation : create parameters procedure init;var i : integer;begin pArray := CreateParam('Array_out',ptArray); setIsInput(pArray,false); ////////////////////////////////////////////////////// st.create; st.clear; stA.create; stA.clear; /////////////////////////////////// stA.loadfromFile(filename); St.SetCommaText(stA.getstrings(0)); setLength(pArray,st.count); for i := 0 to st.count-1 do begin setDataArrayValue(pArray,i,strToFloat(st.getstrings(i))); end; st.free; end;
Edit : cross post hadn't see nay's one, might work out of the box
]]>2017-10-24T17:38:25+02:002017-10-24T17:38:25+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38142#p38142place the csv file in your C: Download
Statistics: Posted by nay-seven — 24 Oct 2017, 17:38
]]>2017-10-24T16:28:03+02:002017-10-24T16:28:03+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38140#p38140Statistics: Posted by Ant1 — 24 Oct 2017, 16:28
]]>
2017-10-24T15:52:53+02:002017-10-24T15:52:53+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38138#p38138Of 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
Statistics: Posted by sm_jamieson — 24 Oct 2017, 15:52
]]>2017-10-24T14:27:47+02:002017-10-24T14:27:47+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38137#p38137Statistics: Posted by 23fx23 — 24 Oct 2017, 14:27
]]>2017-10-24T09:21:58+02:002017-10-24T09:21:58+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38135#p38135 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 !
]]>BrainModularBrainModular Users Forum2017-10-25T17:06:04+02:00https://brainmodular.com/forums/app.php/feed/topic/59222017-10-25T17:06:04+02:002017-10-25T17:06:04+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38149#p38149 A
]]>2017-10-24T20:22:02+02:002017-10-24T20:22:02+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38144#p38144of 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:002017-10-24T17:39:37+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38143#p381431 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:list.txt'; var pArray : Tparameter; var st : TStringList; //////////////////////////////procedure destroy; beginst.free;end // initialisation : create parameters procedure init;var i : integer;begin pArray := CreateParam('Array_out',ptArray); setIsInput(pArray,false); ////////////////////////////////////////////////////// st.create; st.clear; st.loadfromFile(filename); setLength(pArray,st.count); for i := 0 to st.count-1 do begin setDataArrayValue(pArray,i,strToFloat(st.getstrings(i))); 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:list.txt'; var pArray : Tparameter;var stA : TStringList;var st : TStringList; //////////////////////////////procedure destroy; beginst.free; stA.free; end // initialisation : create parameters procedure init;var i : integer;begin pArray := CreateParam('Array_out',ptArray); setIsInput(pArray,false); ////////////////////////////////////////////////////// st.create; st.clear; stA.create; stA.clear; /////////////////////////////////// stA.loadfromFile(filename); St.SetCommaText(stA.getstrings(0)); setLength(pArray,st.count); for i := 0 to st.count-1 do begin setDataArrayValue(pArray,i,strToFloat(st.getstrings(i))); end; st.free; end;
Edit : cross post hadn't see nay's one, might work out of the box
]]>2017-10-24T17:38:25+02:002017-10-24T17:38:25+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38142#p38142place the csv file in your C: Download
Statistics: Posted by nay-seven — 24 Oct 2017, 17:38
]]>2017-10-24T16:28:03+02:002017-10-24T16:28:03+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38140#p38140Statistics: Posted by Ant1 — 24 Oct 2017, 16:28
]]>2017-10-24T15:52:53+02:002017-10-24T15:52:53+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38138#p38138Of 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
Statistics: Posted by sm_jamieson — 24 Oct 2017, 15:52
]]>2017-10-24T14:27:47+02:002017-10-24T14:27:47+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38137#p38137Statistics: Posted by 23fx23 — 24 Oct 2017, 14:27
]]>2017-10-24T09:21:58+02:002017-10-24T09:21:58+02:00https://brainmodular.com/forums/viewtopic.php?t=5922&p=38135#p38135 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 !