Skip to content

Commit 03d7099

Browse files
authored
update amplitude analysis sketch
1 parent 7d61e7e commit 03d7099

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

examples/amplitude_analysis/sketch.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* DEMO: Use p5.Amplitude (volume) to change the size of an ellipse
33
*/
44

5-
var size;
6-
75
var soundFile;
86
var amplitude;
97

@@ -47,8 +45,8 @@ function draw() {
4745
text('volume: ' + volume, 20, 20);
4846

4947
// Change size based on volume. First, map to useful values.
50-
size = map(volume, 0, 1.0, 25, 400);
51-
ellipse(width/2, height/2, size, size);
48+
var diameter = map(volume, 0, 1.0, 25, 400);
49+
ellipse(width/2, height/2, diameter, diameter);
5250

5351
// instruction text
5452
description = 'Spacebar: pause/unpause the loop. <br>Press "N" to toggle Normalize. Normalized is '+amplitude.normalize;

0 commit comments

Comments
 (0)