-
Notifications
You must be signed in to change notification settings - Fork 2
/
l.pde
119 lines (85 loc) · 3.55 KB
/
l.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*---- YOUR CUSTOM CODE BELOW --------------------------*/
/*---- PUT OWN VARIABLES JUST BEFORE customSetup()------*/
// name vars starting with your letter to avoid duplicate variables!
// float aXpos = 0;
// int aSpeed = 0;
void lSetup() { // custom setup = runs once
}
void lDraw() { // custom draw = renders fooorever
//SETTINGS [change, but don't delete any]
credits = "sarah.schiltknecht"; // put your name[s] here!
myTextFont = "FreeSans.ttf"; // set font
myTextSize = height*.8; // *NEW* set text size (0 - height)
useLowerCase = false; // *NEW* optionally set true for lowercase
myTextLength = 15; // custom cut length
processType(); // takes care of type for you, turn off if using custom
background(0); // default background
//backgroundFade(30); // very experimental.. sorta fails in 3D
pushMatrix(); // only adjusts translate/scale within matrix
translate(width/2, height/2, -height/2); // suggestion to draw from center out
if (pointPaths != null) { // only draw if points ready
noFill(); // optional..
if (avgAudio<maxAudio/4) {
translate(0, 0, -height*3);
}
rotate(radians(frameCount*0.09));
for (int i = 0; i < pointPaths.length; i++) {
pushMatrix();
noFill();
stroke(255); // optional...
//fill(255); // optional...
xbeginShape();
for (int j=0; j < pointPaths[i].length; j++) {
int audioFreqIndex = floor(map(j, 0, pointPaths[i].length, 0, fft.avgSize()));
float audioFreq = fft.getAvg(audioFreqIndex)*amp;
if (audioFreq > 10) {
xvertex(pointPaths[i][j].x, pointPaths[i][j].y);
}// try other shapes
// [i] refers to which character, [j] refers to which point in that character
}
xendShape();
popMatrix();
/*pushMatrix();
beginShape();
stroke(255, 80, 120);
for (int j=0; j < pointPaths[i].length; j++) {
int audioWave_x = floor(map(j, 0, pointPaths[i].length, 0, in.bufferSize()));
float audioWave = in.left.get(j)*amp;
vertex(audioWave_x, height*.25 + audioWave);
//if ( > 10) {
pushMatrix();
rotate(radians(frameCount*0.5));
//ellipse(pointPaths[i][j].x, pointPaths[i][j].y,audioFreq,audioFreq);
line(pointPaths[i][j].x+audioWave, pointPaths[i][j].y+audioWave, audioWave, audioWave);
popMatrix();
//}
}
endShape();
popMatrix();*/
stroke(255);
for (int j=0; j < pointPaths[i].length; j++) {
int audioFreqIndex = floor(map(j, 0, pointPaths[i].length, 0, fft.avgSize()));
float audioFreq = fft.getAvg(audioFreqIndex)*amp;
if (audioFreq > 10) {
pushMatrix();
//translate(width/3, height/10, map(100, 0, height, -100, 100));
//rotateY(radians(frameCount*.09)); // (mouseX) moves
//ellipse(pointPaths[i][j].x, pointPaths[i][j].y,audioFreq,audioFreq);
rect(pointPaths[i][j].x, pointPaths[i][j].y, 62, audioFreq);
popMatrix();
} else if (audioFreq < 20) {
fill(255);
pushMatrix();
stroke(255);
translate(width/7, height/17, map(100, 0, height, -100, 100));
vertex(pointPaths[i][j].x, pointPaths[i][j].y, 100, 100);
popMatrix();
}// try other shapes
// [i] refers to which character, [j] refers to which point in that character
}
}
}
popMatrix();
}
/*---- YOUR CUSTOM CODE ABOVE ------------------------*/
/***** DON'T EDIT BELOW *******************************/