getLinesData function in P5 in construction. xrns osc/midi communicaton

master
Nova deViator 2015-09-11 14:56:09 +02:00
parent 5357893485
commit f37ead2438
4 changed files with 203 additions and 22 deletions

View File

@ -1,11 +1,21 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Interface Fractures III - SILICON
(c) nova@deviator.si
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
IF3Si.pde
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Interface Fractures III - Silicon
(c) Luka Prinčič / Nova deViator
nova@deviator.si
IF3Si.pde
*/
// undecorate window (remove window borders etc) - - - - - - - - - - - - - - -
public void init() { frame.removeNotify(); frame.setUndecorated(true);
frame.addNotify(); super.init(); }
@ -65,7 +75,7 @@ PFont fpsFont;
boolean testPatternToggle = false;
// siLines
String[] siLinesData;
ArrayList<FloatList> siLinesData;
///////////////////////////////////////////////////////////////////////////////
void setup() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -95,26 +105,18 @@ void setup() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
println("\n\n~~~ loading textures into image pool ...\n");
imgPool = getImages("/images/");
siLinesData = loadStrings(dataPath(sketchPath + "/silicon_lines.txt"));
printArray(siLinesData);
for (String lineData : siLinesData ) {
String[] datatemp = split(lineData, " ");
String data_x[];
for (String item : datatemp) {
for (int i = 0; i < datatemp.length && item != ""; i++) {
//if (item != "") {
data_x[i] = item; }
//}
//data-x.add
}
//datatemp = sort(datatemp);
//datatemp = reverse(datatemp);
printArray(datatemp);
printArray(data_x);
}
// ----------------------------------------------------------------------
println("~~~ getting and processing lines data ...");
//siLinesData = new ArrayList<FloatList>();
siLinesData = getLinesData(); // function, returns an ArrayList
// ----------------------------------------------------------------------
// create an array of random value between -50 and 50
for (int i=0; i < 500; i++) { rands[i] = i-250; }

View File

@ -0,0 +1,55 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Interface Fractures III - Silicon
(c) Luka Prinčič / Nova deViator
nova@deviator.si
getLinesData.pde - process spectral lines
*/
ArrayList<FloatList> getLinesData() {
String[] siLinesData;
siLinesData = loadStrings(dataPath(sketchPath + "/silicon_lines.txt"));
ArrayList<FloatList> siLinesList = new ArrayList<FloatList>();
for (String lineData : siLinesData ) {
String[] datatemp = split(lineData, " ");
FloatList data_x;
data_x = new FloatList();
for (int i = 0; i < datatemp.length; i++) {
if (!datatemp[i].equals("")) { // if not empty (spaces):
data_x.append(float(datatemp[i]));
}
}
printArray(data_x);
siLinesList.add(data_x);
}
for(int i = 0; i < siLinesList.size(); i ++) {
println(siLinesList.get(i).get(0));
}
//printArray(siLinesList);
return siLinesList;
}

124
pde/IF3Si/silicon_lines.txt Normal file
View File

@ -0,0 +1,124 @@
3905.52 300
3955.74 10
3977.46 10
3991.77 15
3998.01 10
4075.45 20
4076.78 15
4102.94 70
4128.07 300
4130.89 500
4183.35 10
4190.72 100
4198.13 50
4621.42 100
4621.72 150
4782.99 50
4792.21 35
4792.32 80
4883.20 15
4906.99 20
4932.80 20
4947.61 30
5006.06 40
5041.03 1000
5055.98 1000
5181.90 100
5185.25 100
5192.86 200
5202.41 500
5295.19 30
5405.34 100
5417.24 15
5428.92 15
5432.89 15
5438.62 100
5447.26 20
5454.49 15
5456.45 100
5466.43 500
5466.87 500
5469.21 100
5493.23 40
5496.45 200
5517.54 35
5540.74 100
5576.66 150
5622.22 30
5632.97 100
5639.48 200
5645.61 90
5660.66 150
5665.55 80
5669.56 1000
5681.44 30
5684.48 120
5688.81 300
5690.43 100
5701.11 90
5701.37 200
5706.37 100
5708.40 160
5747.67 45
5753.63 45
5754.22 45
5762.98 45
5772.15 70
5780.38 70
5785.73 30
5793.07 90
5794.90 30
5797.86 100
5800.47 150
5806.74 200
5827.80 30
5846.13 50
5867.48 10
5868.40 300
5873.76 40
5915.22 150
5948.55 200
5957.56 500
5978.93 500
6067.45 10
6080.06 20
6086.67 10
6125.02 90
6131.57 85
6131.85 90
6142.49 100
6145.02 100
6155.13 160
6237.32 160
6238.29 40
6243.81 125
6244.47 125
6254.19 180
6331.95 45
6347.10 1000
6371.36 1000
6526.61 45
6527.20 45
6555.46 45
6660.52 50
6665.00 15
6671.88 100
6699.38 20
6717.04 50
6721.85 100
6741.64 30
6750.28 20
6818.45 30
6829.82 50
6848.57 30
6976.52 80
7003.57 180
7005.88 180
7017.28 30
7017.65 90
7034.90 250
7164.69 70
7165.55 200
7184.89 70
7193.58 65
7193.90 30

Binary file not shown.