Hi,
I’ve put together a very easy sketch which uses the Sound library to create a basic show which i then visualize on the sketch.
What i would like to achive:
- Export the sound
- Save the visual as a gif (i’ve been reading a lot around but it looks like there’s no an easy way to do it).
import processing.sound.*;
SinOsc sin;
LowPass lowPass;
Reverb reverb;
Waveform waveform;
int samples = 640;
void setup() {
size(800, 800);
background(0);
sin = new SinOsc(this);
lowPass = new LowPass(this);
reverb = new Reverb(this);
sin.play();
lowPass.process(sin, 100);
reverb.process(sin);
reverb.room(1);
waveform = new Waveform(this, samples);
waveform.input(sin);
}
void draw() {
background(255);
stroke(200);
strokeWeight(2);
noFill();
waveform.analyze();
beginShape();
for(int i = 0; i < samples; i++) {
vertex(
map(i, 0, samples, 0, width),
map(waveform.data[i], -1, 1, 0, height)
);
}
endShape();
}
Anyone can point me in the right direction for both points?
Thanks a lot in advance
Regards