Marco H
YaBB Newbies
Offline
Posts: 8
Portugal
MovieMaker with audio
Jan 6th , 2010, 9:31am
Hi, I´m trying to export a video that has video input without sound, and an mp3 input for beat detection. Am I able to export the output video with sound, merge the two inputs with beat detection in one final video (with sound) output? Another question: Can I do beat detection (with minim Library) from the sound that comes out de video input? This is my code: import processing.video.*; import ddf.minim.*; import ddf.minim.analysis.*; Movie filme; Minim minim; AudioPlayer musica; BeatDetect beat; BeatListener b; MovieMaker filme_final; float kickSize, snareSize, hatSize = 100; int instante_width = 720; int instante_height= 576; void setup() { size(720, 576); imageMode(CENTER); filme = new Movie(this, "circles_edit_mpeg4.mov"); minim = new Minim(this); musica = minim.loadFile("circles_audio.mp3"); beat = new BeatDetect(musica.bufferSize(), musica.sampleRate()); beat.setSensitivity(10); b = new BeatListener(beat, musica); filme.play(); musica.play(); filme_final = new MovieMaker(this, width, height, "final.mov", 25, MovieMaker.JPEG, MovieMaker.LOSSLESS); } void draw() { filme_final.addFrame(); instante_width = 720; instante_height= 576; if(keyPressed) { if (key == 's') { if ( beat.isKick() ) kickSize = 110; if ( beat.isHat() ) hatSize = 120; if ( beat.isSnare() ) snareSize = 130; kickSize = constrain(kickSize * 0.95, 100, 110); hatSize = constrain(hatSize * 0.95, 100, 120); snareSize = constrain(snareSize * 0.95, 100, 130); instante_width = int((width*(kickSize+hatSize+snareSize)/3)/100); instante_height = int((height*(kickSize+hatSize+snareSize)/3)/100); } } image(filme, width/2, height/2, instante_width, instante_height); if(keyPressed) { if (key == 'f') { if ( beat.isKick() || beat.isHat() || beat.isSnare() ) { noStroke(); fill(255, 255, 255, 90); rect(0, 0, width, height); noFill(); } } if (key == 'q') stop(); } } void movieEvent(Movie m) { m.read(); } void stop() { filme_final.finish(); musica.close(); minim.stop(); super.stop(); exit(); } class BeatListener implements AudioListener { private BeatDetect beat; private AudioPlayer source; BeatListener(BeatDetect beat, AudioPlayer source) { this.source = source; this.source.addListener(this); this.beat = beat; } void samples(float[] samps) { beat.detect(source.mix); } void samples(float[] sampsL, float[] sampsR) { beat.detect(source.mix); } }