Upload files to '12'

master
barkaiavital 5 years ago
parent 4effc53e1a
commit f4d517716a

@ -0,0 +1,51 @@
let mic, fft;
let spacer;
let t = 0; // time variable
function setup(){
createCanvas(710, 400);
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT();
fft.setInput(mic);
noStroke();
fill(255);
}
function draw() {
background(0);
strokeWeight(2);
stroke(255);
//frameRate(10);
let spectrum = fft.analyze();
//console.log(spectrum.length);
// console.log(spectrum);
// beginShape();
// for (i = 0; i < spectrum.length; i++) {
// vertex(i, map(spectrum[i], 0, 255, height, 0));
// }
// endShape();
beginShape();
for (x = 0; x < spectrum.length; x= x+5) {
// stroke(255);
//noStroke();
let alpha = map(spectrum.length, 0,1024,0,100)
strokeWeight(2);
stroke(114,126,143, alpha);
noFill();
print(alpha)
//fill(255,255,255, alpha);
//console.log(spectrum[x]);
line(width/random(8) ,height/random(8) , spectrum[x]*10, spectrum[x]*8);
//line(random(300,700) ,random(200,300), spectrum[x]*10, spectrum[x]*15);
line(spectrum[x]*8, spectrum[x]*8, spectrum[x]*12, alpha*10);
//rect(600 , 100, spectrum[x]/1.8, spectrum[x]/1.8);
}
endShape();
}

@ -0,0 +1,15 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.1/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.1/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.1/addons/p5.sound.min.js"></script>
<script src="sketch2.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
Loading…
Cancel
Save