• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Playing sound in Java

 
Kunal Goswami
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, AudioClip is not the way to go. A quick search found http://forum.codecall.net/topic/58228-playing-simple-sampled-audio-in-java/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic