How to sincronize the audio in a way that fade out the image?

edited July 2017 in Library Questions

hi everyone! Im new using processing, and i find myself stuck with this doubt, im looking for something that helps me to sincronize the audio and the image and fade out the image, all of that part is in the keyPressed part, i hope i make myself clear

import ddf.minim.*;

PImage img1, img2;
int trans ;
int vol = 1;
float transparency = 255;
AudioPlayer latido;
AudioPlayer pip;
Minim minim;

void setup() {

  size(500, 500);
  trans = 255;
  vol = 1;
  pipi = 3;
  img1 = loadImage("cora.jpg");
  minim = new Minim(this);
  pip = minim.loadFile("pip.mp3");
  latido = minim.loadFile("latido.mp3");
  // the audio "latido" in loop

void draw() {
  //i combine the audio with the transparency of the image
  int vol = int(latido.mix.level()*500);
  int trans = int(map(vol,-100,200,80,200));
  image(img1, -30, -300); 

  if (transparency > 0) { transparency -= 10; }
  tint(0, transparency);
  image(img1, -30, -300);
**        void keyPressed(){
          //when you press any key the audio "latido" stop, and another audio(pip) starts and the image fade out with tthe last audio(here is my doubt)





Sign In or Register to comment.