Beginner coding Help!! sound to image help...
in
Programming Questions
•
1 month ago
Hey,
I am trying to edit a preexisting code 'pointillism'. Instead of reacting to the location of the mouse, I am hoping to program it to react to a live audio input, something like the higher the frequency the smaller the circles. I am extremely new to this and have no idea where to start so any help would be amazing.
The code is below
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs preload="yes.jpg"; */
PImage img;
int smallPoint, largePoint;
void setup() {
size(1450, 800);
img = loadImage("yes.jpg");
smallPoint = 4;
largePoint = 40;
imageMode(CENTER);
noStroke();
background(255);
}
void draw() {
float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
int x = int(random(img.width));
int y = int(random(img.height));
color pix = img.get(x, y);
fill(pix, 128);
ellipse(x, y, pointillize, pointillize);
}
Is anyone able to help me out here, I would greatly appreciate it!
And could anyone recommenced any good sites for beginner learning in this sort of area?
Thanks again! :)
I am trying to edit a preexisting code 'pointillism'. Instead of reacting to the location of the mouse, I am hoping to program it to react to a live audio input, something like the higher the frequency the smaller the circles. I am extremely new to this and have no idea where to start so any help would be amazing.
The code is below
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs preload="yes.jpg"; */
PImage img;
int smallPoint, largePoint;
void setup() {
size(1450, 800);
img = loadImage("yes.jpg");
smallPoint = 4;
largePoint = 40;
imageMode(CENTER);
noStroke();
background(255);
}
void draw() {
float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
int x = int(random(img.width));
int y = int(random(img.height));
color pix = img.get(x, y);
fill(pix, 128);
ellipse(x, y, pointillize, pointillize);
}
Is anyone able to help me out here, I would greatly appreciate it!
And could anyone recommenced any good sites for beginner learning in this sort of area?
Thanks again! :)
1