File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes  Playing sound in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Playing sound in Java " Watch " Playing sound in Java " New topic
Author

Playing sound in Java

Kunal Goswami
Greenhorn

Joined: Oct 15, 2013
Posts: 2
I am learning programming in java. I read about the clip() method, and I passed a file in my C:/My Music folder as the url, it shows no exception but no song is played. I have the song.wav file at the specified path. But I do not hear any sound when I run this program. I use Eclipse IDE, at first I specified the path as " C:/My Music/song.wav" but it showed an exception of unknown protocol, hence I added file://C:... to the path, yet I do not hear any sound, I want to make a program which while running plays this song.wav as background music. Please help me and guide me on what to do?

Here's the code ( only for playing the song )
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

I think the AudioClip is only working with a Java applet which is embedded in a web page.
In your case, using it in a stand-alone program wouldn't be possible.


PM Me If You Want to get Urgent Help on Java Programming
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
Yep, AudioClip is not the way to go. A quick search found http://forum.codecall.net/topic/58228-playing-simple-sampled-audio-in-java/


Ping & DNS - my free Android networking tools app
 
 
subject: Playing sound in Java