Hi @markcosmic …
At first, i am child in processing, rsrs… I am mixing lots of exemple and researchs about. Also have a book called
“Processing:
a programming
handbook for
visual designers
and artists
Casey Reas
Ben Fry” [740 pgs]
So, its all about brainwaves (in this very moment…i am moving on), mixup Hz, form audio (BPM and Hz), range (Hz wich arrive in our eyes)of colors e FLASHS/Strobe of lights per second… We do not work with the same Hz in flash light as we do in sound, theyer ranges are very diferent (1# becaue our body "ready"it diferently) but there is a way to mach them… …
In binaural audio we use ex.: 200 Hz left and 120Hz right ear, our brain will work in 80 Hz. It can be done in differentes beats of the music. (its another world, lol… i love it)
Some exemples :
https:[OSA Festival 2020 - spot on Vimeo]
(OSA Festival 2020 - spot on Vimeo)//vimeo.com/218769844
https://vimeo.com/218769844
The main stream in this post is How to Make things Flash/strob per second.
The result of what i’v done until now (I AM OPEN TO NEWS, PLEASE!) in this project is this:
import processing.sound.*;
SoundFile sample;
SoundFile sample1;
Amplitude rms;
float smoothingFactor = 0.25;
// Used for storing the smoothed amplitude value
float sum;
float xRed = 62, xGreen = 20, xBlue = 173;
float yRed = 207, yGreen = 1, yBlue = 106;
boolean backwards=false;
int timeLapse=400;
int timeTrack;
PImage img;
PShader blur;
int a = 100; // Create a global variable "a"
PFont f;
float angleRotate = 0.0;
void setup() {
size(640, 360);
f = createFont("AgencyFB-Bold-48.vlw", 27);
textFont(f);
timeTrack=millis()+timeLapse;
blur = loadShader("blur.glsl");
//Load and play a soundfile and loop it
sample = new SoundFile(this, "At.mp3");
sample.loop();
// Create and patch the rms tracker
rms = new Amplitude(this);
rms.input(sample);
img = loadImage("et.png");
imageMode(CENTER);
}
void draw() {
background(0);
noStroke();
//noLoop();
// fill(255, 0, 150);
//image(img, mouseX, mouseY);
int m = millis();
fill(m % 120);
rect(20, 20, 600, 320, 30);
tint(255, 120);
image(img, width/2, height/2);
pushMatrix();
float angle1 = radians(90);
translate(35, 120);
rotate(angle1);
fill(31, 255, 96, 90);
text("VrtX_@rT", 0, 0);
//line(20, 20, 150, 0);
popMatrix();
//Next inverts diretion
if (millis()>timeTrack) {
timeTrack=millis()+timeLapse;
backwards=!backwards;
}
float per = (timeTrack-millis())/float(timeLapse);
if (backwards==true) {
per = 1-per;
}
// surface.setTitle(nf(per*100, 3, 2)+"% Flag="+backwards);
fill(lerpColor(color(xRed, xGreen, xBlue, 200), color(yRed, yGreen, yBlue, 90), per));
//ellipse(width/2, height/2, 300, 300);
// Draw a line using the global variable "a"
line(a, 0, a, height);
// Create a new variable "a" local to the for() statement
for (int a = 35; a < 150; a += 2) {
line(a, 0, a, height);
}
for (int a = 95; a < 250; a += 8) {
stroke(#FF1FBC);
line(a, 0, a, height);
}
for (int a = 15; a < 200; a += 9) {
stroke(#B161F7);
line(a, 0, a, height);
}
// Create a new variable "a" local to the draw() function
int a = 300;
// Draw a line using the new local variable "a"
stroke(#1FFF6B);
line(a, 0, a, height);
// Make a call to the custom function drawAnotherLine()
drawAnotherLine();
// Make a call to the custom function setYetAnotherLine()
drawYetAnotherLine();
}
void drawAnotherLine() {
// Create a new variable "a" local to this method
int a = 320;
// Draw a line using the local variable "a"
stroke(#1FFF6B);
line(a, 0, a, height);
}
void drawYetAnotherLine() {
// Because no new local variable "a" is set,
// this line draws using the original global
// variable "a", which is set to the value 80.
line(a+2, 0, a+2, height);
// smooth the rms data by smoothing factor
sum += (rms.analyze() - sum) * smoothingFactor;
//sum += (rms.analyze() - sum) * smoothingFactor;
// rms.analyze() return a value between 0 and 1. It's
// scaled to height/2 and then multiplied by a fixed scale factor
float rms_scaled = sum * (height/2) * 2;
//float rms_scaled1 = sum * (height/2) *3;
// We draw a circle whose size is coupled to the audio analysis
ellipse(width/1.26, height/1.65, rms_scaled, rms_scaled);
//eliipse(width/1, height/1, rms_scaled1, rms_scaled1);
}