Results 1 to 3 of 3
Thread: help to play file.wav in java
- 03-25-2010, 07:52 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 61
- Rep Power
- 0
help to play file.wav in java
i make this simple code to play .wave file
the code run correctly but the file not play , what's the problem ???Java Code:public class Main { public static void main(String[] args) throws FileNotFoundException, IOException { InputStream in = new FileInputStream("music/buzz.wav"); AudioStream as = new AudioStream(in); AudioPlayer.player.start(as); AudioPlayer.player.stop(as); } }
- 03-25-2010, 08:09 PM #2
Senior Member
- Join Date
- Mar 2010
- Posts
- 266
- Rep Power
- 4
My guess would be that you're starting the playback of your WAV and the immediately stopping it. Try inserting
between the start() and the stop(). If i'm right, you should hear the sound for 5 seconds.Java Code:try { Thread.sleep (5000); } catch (Throwable t) { }
- 03-26-2010, 03:10 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Actually that's one reason. But the implementation is not correct. In this way you cannot create an audio stream using input stream. Have a look at the following article.
Java play WAV sound file - AnyExample.com
Similar Threads
-
Play wave file out of a jar file
By schliz in forum Advanced JavaReplies: 2Last Post: 12-03-2009, 01:37 PM -
Play avi file in JMF
By ramkumarm in forum AWT / SwingReplies: 0Last Post: 04-15-2009, 01:49 PM -
How to play Flash File inmy frame?
By makpandian in forum AWT / SwingReplies: 1Last Post: 02-12-2009, 01:01 PM -
play vedio file and flash file in swing
By rajasekharreddym in forum AWT / SwingReplies: 1Last Post: 07-30-2008, 08:22 PM -
how can I play an mp3 file in java?
By iliana in forum NetworkingReplies: 1Last Post: 05-30-2008, 07:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks