visualizer

master
Your Name 5 years ago
parent 904c562d8b
commit 49c7923528

@ -9,6 +9,10 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" <link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto Mono"> href="https://fonts.googleapis.com/css?family=Roboto Mono">
<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="sketch.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="back"><a href="https://issue.xpub.nl/"> ↰ Main Page </a></div> <div class="back"><a href="https://issue.xpub.nl/"> ↰ Main Page </a></div>

@ -0,0 +1,22 @@
let mic, fft;
function setup() {
createCanvas(710, 400);
noFill();
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT();
fft.setInput(mic);
}
function draw() {
background(200);
let spectrum = fft.analyze();
beginShape();
for (i = 0; i < spectrum.length; i++) {
vertex(i, map(spectrum[i], 0, 255, height, 0));
}
endShape();
}
Loading…
Cancel
Save