# Export sound and gif from a sketch

**URL:** <https://discourse.processing.org/t/export-sound-and-gif-from-a-sketch/32628>\
**Category:** Libraries\
**Created:** [October 5, 2021, 10:41am UTC](https://discourse.processing.org/t/export-sound-and-gif-from-a-sketch/32628 "2021-10-05T10:41:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteo](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@matteo](https://discourse.processing.org/u/matteo)\
**Post date:** [October 5, 2021, 10:41am UTC](https://discourse.processing.org/t/export-sound-and-gif-from-a-sketch/32628/1 "2021-10-05T10:41:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)\
**Post date:** [October 5, 2021, 10:50am UTC](https://discourse.processing.org/t/export-sound-and-gif-from-a-sketch/32628/2 "2021-10-05T10:50:07Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![hotfooted](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hotfooted/32/3670_2.png) [@hotfooted](https://discourse.processing.org/u/hotfooted)\
**Post date:** [October 5, 2021, 11:37am UTC](https://discourse.processing.org/t/export-sound-and-gif-from-a-sketch/32628/3 "2021-10-05T11:37:07Z")

</div>

an alternative which i haven’t tested yet but looks promising is [hamoid](https://github.com/hamoid)/ **[video\_export\_processing](https://github.com/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](https://forum.processing.org/two/discussion/8994/real-time-video-export-from-processing)

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.
