i just asked chatGPT: “can you write me a code for eyesy video synthesizer that is audio reactive and creates psychedelic images?”
i don’t have my eyesy with me at present so i can’t see what i’ve just had it do, but i’ll try to copy/paste it here so maybe one of y’all can run it.
anyway… just kinda seems like a breakthrough way to interact with Eyesy… (for me at least)
#include “ofMain.h”
#include “ofxMaxim.h”
class ofApp : public ofBaseApp {
public:
void setup() {
ofSetBackgroundColor(0);
ofSetFrameRate(60);
ofEnableAlphaBlending();
// Initialize audio input
audioInput.setup(0, 2, 44100, 512, 3);
audioInput.setOutputVolume(0);
audioInput.setUseTexture(false);
// Set up the audio analyzer
analyzer.setup(512, 256, 0);
analyzer.setAverages(8, 3);
// Set up the visualizer
visualizer.setup(ofGetWidth(), ofGetHeight());
}
void update() {
// Get the audio data
audioInput.getNextBuffer(audioBuffer, 512, 2);
// Analyze the audio
analyzer.calculate(audioBuffer);
// Map the audio data to visual parameters
float hue = ofMap(analyzer.getAverage(0), 0, 0.1, 0, 255);
float saturation = ofMap(analyzer.getAverage(1), 0, 0.1, 0, 255);
float brightness = ofMap(analyzer.getAverage(2), 0, 0.1, 0, 255);
float speed = ofMap(analyzer.getAverage(3), 0, 0.1, 0, 5);
// Update the visualizer
visualizer.update(hue, saturation, brightness, speed);
}
void draw() {
// Draw the visualizer
visualizer.draw();
}
private:
ofxMaxiMix audioInput;
float audioBuffer[512 * 2];
ofxMaxiFFT analyzer;
ofxMaxiFFTOctaveAnalyzer octaveAnalyzer;
Visualizer visualizer;
};
class Visualizer {
public:
void setup(int width, int height) {
ofSeedRandom(42);
mesh.setMode(OF_PRIMITIVE_TRIANGLES);
for (int i = 0; i < 1000; i++) {
mesh.addVertex(ofVec3f(ofRandom(width), ofRandom(height)));
mesh.addColor(ofColor(0, 0, 0, 0));
}
for (int i = 0; i < 2000; i++) {
mesh.addIndex(ofRandom(1000));
mesh.addIndex(ofRandom(1000));
mesh.addIndex(ofRandom(1000));
}
}
void update(float hue, float saturation, float brightness, float speed) {
for (int i = 0; i < mesh.getNumVertices(); i++) {
ofVec3f& vertex = mesh.getVertices()[i];
ofColor& color = mesh.getColors()[i];
vertex.x += ofSignedNoise(vertex.x / 100.0, vertex.y / 100.0, ofGetElapsedTimef() * speed) * 5;
vertex.y += ofSignedNoise(vertex.x / 100.0, vertex.y / 100.0, (ofGetElapsedTimef() * speed) + 1000) * 5;
float alpha = ofMap(ofDist(vertex.x, vertex.y, ofGetWidth() / 2, ofGetHeight() / 2), 0, ofDist(0, 0, ofGetWidth() / 2, ofGetHeight() / 2), 255, 0);
color.setHsb(hue, saturation, brightness,
maybe it’s cool. maybe it’s junk.
cheers