We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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();
}
}
Answers
line 22
playlist[0].play();
we don't want line 4,11
Ah, I see the mistake I made there, thank you for clearing that up.
Yes, just rely on playList here
Hi,
I'm trying to do the same thing but I got this error message:
How do i fix this??
Also, is it possible for processing to detect sound, then plays the audio files, instead of pressing buttons?
Thanks!
APIC Attached picture
is that stopping the code from working? or is it just warning you? you can probably remove that tag from the file with the correct tools.
I think its only a warning