Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

How to play an audio file sequentially.

$
0
0

Hey, I'm working on a new piece where a random number generator is connected to sound files of a lady I know screaming the numbers. So when the generator hits 1 it plays her screaming 1 and so on. I'm having trouble because I want the code to be in "void draw", however the audio files play over each other when I place it into that section.

I imagine that I need a piece of code to tell the next audio file to wait until the end of the last before it plays but I am an absolute beginner at coding, so I have no idea how to write it.

I have attached what I have done so far for reference, there is only one audio file in so far as I felt it was best to start simply and then add more audio files as I go.

        import ddf.minim.*;
    
        Minim house;
        AudioPlayer player1;
    
        int christine;
    
        void setup(){
          size(100,100);
        }
    
        void draw(){
      
           house = new Minim(this);
      
          player1 = house.loadFile("u.wav");
      
      
          christine = (int)random(10);
      
          println("christine is "  + christine);
        player1.play();
        player1.isPlaying();
        for (int =
        }
    

Viewing all articles
Browse latest Browse all 2896

Trending Articles