Sound in sun.audio.*;

P

Pak_indo

Hi folks,

ok, I have 5 or so files which need to be played one after another, pretty
much immediately after another such that it sounds like theyre kinda linked
so to speak(I cant make one big file as the order they come in differs on
runtime)
What i would like to know is, is this possible with this package? The
current code I am using to play is
try{
InputStream in = new FileInputStream(fileName);
// Create an AudioStream object from the input stream.
AudioStream as = new AudioStream(in);
// Use the static class member "player" from class AudioPlayer to play
// clip.
AudioPlayer.player.start(as);
// Similarly, to stop the audio.
//AudioPlayer.player.stop(as);
}
catch(Exception e){System.out.println(e);}

and would like to know how I can manipulate this to play them one after
another, ie is there a specific method which would help me etc.

Thanks for any time which anyone could give me

cheers

pak
 
K

Knute Johnson

Pak_indo said:
Hi folks,

ok, I have 5 or so files which need to be played one after another, pretty
much immediately after another such that it sounds like theyre kinda linked
so to speak(I cant make one big file as the order they come in differs on
runtime)
What i would like to know is, is this possible with this package? The
current code I am using to play is
try{
InputStream in = new FileInputStream(fileName);
// Create an AudioStream object from the input stream.
AudioStream as = new AudioStream(in);
// Use the static class member "player" from class AudioPlayer to play
// clip.
AudioPlayer.player.start(as);
// Similarly, to stop the audio.
//AudioPlayer.player.stop(as);
}
catch(Exception e){System.out.println(e);}

and would like to know how I can manipulate this to play them one after
another, ie is there a specific method which would help me etc.

Thanks for any time which anyone could give me

cheers

pak

You can use JavaSound to play your files. I would use a LineListener to
check for the end of the audio stream and then open the next stream. If
the files are not too long you could also use the Clip interface to load
the entire file and play them in any order.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top