Export sound and gif from a sketch

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:

  1. Export the sound
  2. 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

The new version of MovieMaker tool in Processing4 can do gif loops.
in menu bar : tools>MovieMaker
Before you must save all your frames with

saveFrame("myGif####.tga"); // at the end of your draw()

For the sound it’s maybe better to record it with external program like audacity and after merge both in MovieMaker tool.

an alternative which i haven’t tested yet but looks promising is hamoid/ video_export_processing

it does rely on ffmpeg though which may or may not be an issue for you

you can read the origin here

according to the changelog

  • 0.1.5 - December 2nd, 2016
    • Refactoring. Clean up code.
    • Add .startMovie() and .endMovie() to prevent possible “missing-end-of-movie corruption”.
    • Allow attaching a sound file to the produced movie.
    • Allow exporting multiple video files using the same videoExport object.