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

Simple Array That Plays Audio

$
0
0

Hello, I have been learning processing for about 4 weeks now. I have started playing with arrays and have had found success using them for various thing such as scrolling through colors and then later on images. I now am trying to reproduce this using sound. I have looked at others examples for a simple way to scroll through the songs. I have not had success other than getting one song play on keyPressed ( which I am aware is because I have music = minim.loadFile ("song1.mp3"); )

I would appreciate any guidance on how to properly load this array successfully so I can see where I have steered wrong. Thank you in advance.

import ddf.minim.*;

Minim minim;
AudioPlayer music;
AudioPlayer[] playlist;
AudioInput input;

void setup() {
  size(100,100);
  minim = new Minim(this);
  music = minim.loadFile("song1.mp3");
  input = minim.getLineIn();

  playlist = new AudioPlayer[2];
  playlist[0] = minim.loadFile("song1.mp3");
  playlist[1] = minim.loadFile("song2.mp3");
}

void keyPressed(){

if ( keyCode == 'p' ){
    music.play();
  }
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles