i want to play an audio file in java without opening a player ...

like an alarm ...

does any1 knows how to do this.. and r there any sample codes available online ... (please provide relevant links only)

Recommended Answers

All 6 Replies

hmm wierd, what didn't you find? I typed in

java play audio file

and found a ton of stuff in google . . .

commented: That's because you actually have enough initiative to try to learn on your own and think for yourself :) +18

After 61 posts here, you should be well aware that "chat-speak" or "IM-speak" is discouraged in the forum rules. Are you really too lazy to type out all of the letters and use punctuation where appropriate? Should anyone else spend their time to help someone who doesn't care enough to take the time to communication properly? Think about it.

That said, try the Java Media Framework. You can find a lot of demo code and examples here: http://java.sun.com/javase/technologies/desktop/media/jmf/reference/codesamples/index.html

commented: Excellent post. +6

hmm wierd, what didn't you find? I typed in

java play audio file

and found a ton of stuff in google . . .

the prob is, that the player should not open ... and only the sound should play ..... like in gmail chat , wen a new message comes, a sound also plays...(but without opening a player)

commented: Ezzaral already mentioned the rule about chat speak once, how many times do you need to be told to understand. -1

I tried to help you once. Again I typed in "Java play audio file" and the first result from google was here
http://www.google.com/search?hl=en&q=java+play+audio+file
in google the description says this
"Here's a step-by-step guide to playing audio files in a Java application"


And Ezzaral is right, please refrain from using IM type speak. This isn't a chat room. :)

just because you play an audio file doesn't mean you have to open a visible player.

now, if you want to play a .wav or .au file, or something similar, you don't need to install JMF or anything like that, but if you're trying to play .mp3 files, you have (as far as I know) 2 options (propably more, but only looked into these two myself):
1. the Java Media Framework, provided by Sun
2. the JLayer - mp3 library. I've used this one since it was VERY user friendly.

you should be able to write an application that does the trick by now, if it doesn't work, don't just repeat the question, but show us the code you have so far, and explain what function of it doesn't work the way you want it to

thanks a lot, I'll try coding it, and if i come across any errors, I'll contact you guys,, thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.