This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 485

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: 39578
    
  27
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 - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Playing sound in Java
 
Similar Threads
Progress Bar while using Streaming
The GUI Thread.
Data loss during file transfer
AudioPlayer issues
sugar needed for Java! help me, please.