Hi all,
I’m trying to export my sketch using the VideoExport function (Hamoid import) but am losing sound on playback. I’ve copied my code below - am I missing something?
Thanks in advance,
Jess
import com.hamoid.*;
import ddf.minim.*;
Minim minim;
AudioPlayer song;
int spacing = 16; // space between lines in pixels
int border = spacing*2; // top, left, right, bottom border
int amplification = 3; // frequency amplification factor
int y = spacing;
float ySteps; // number of lines in y direction
VideoExport videoExport;
void setup() {
size(800, 800);
background(255);
strokeWeight(1);
stroke(0);
noFill();
minim = new Minim(this);
song = minim.loadFile("Julia.mp3");
song.play();
videoExport = new VideoExport(this, "myVideo.mp4");
videoExport.setFrameRate(30);
videoExport.startMovie();
}
void draw() {
int screenSize = int((width-2*border)*(height-1.5*border)/spacing);
int x = int(map(song.position(), 0, song.length(), 0, screenSize));
ySteps = x/(width-3*border); // calculate amount of lines
x -= (width -3*border)*ySteps; // set new x position for each line
float frequency = song.mix.get(int(x))*spacing*amplification;
rect (x+border, y*ySteps+border, frequency*50, frequency*50);
videoExport.saveFrame();
}
void stop() {
videoExport.endMovie();
song.close();
minim.stop();
super.stop();
}