chatGPT whoa

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

not sure why the formatting of the copy/paste looks like that with some in a gray box and some not, but that’s what pasted when i clicked ‘copy code’

1 Like

Def great thinking to ask ChatGPT! I’m gonna try this one, and will update with some feedback. Thanks for sharing!

1 Like

I did something similar recently - got chat GPT to code me some c code for a sampler/LFO thing I had in mind. The attempt looks credible but I’m yet to test it.

1 Like

ChatGPT is also a great help with licensing - it just generated my CC-BY 4.0 license template for my latest patch before. It’s able to create Pure Data examples too but I didn’t go too deep on this yet.

2 Likes