0

how do i make to play sound in my program after turning on i tryed some codes but the song doesnt start ...
I maked the song into 10 secounds but still cannot start.
anyone help ?

3
Contributors
9
Replies
31
Views
3 Years
Discussion Span
Last Post by stultuske
Featured Replies
  • 1

    be more clear about what format you are trying to play. if it's just a .wav file, you don't need any additional libraries, but, if you want (for instance) to play .mp3 files, you should note that they are not supported by core Java. in order to play those, you'll … Read More

1

be more clear about what format you are trying to play.
if it's just a .wav file, you don't need any additional libraries, but, if you want (for instance) to play .mp3 files, you should note that they are not supported by core Java.

in order to play those, you'll need to add an additional library or framework that can help you out.
my first thoughts would be the Java Media Framework api, or JMF for short, or JavaZoom's JLayer library.

personally, when I once tried to write my own mp3 player, I preferred JLayer over JMF. JMF hadn't been updated for quite a while, and it was a bit more messy to set everything up. besides, JLayer is pretty easy to work with, if you go through the documentation and example(s) they offer.

0

Thanks in advice i tryed with (.wav) and worked but my project is to drag it in the program or upload it and just play/stop from there, yeah it is like small player, so if you can give me some exsample how to start with that draging/uploading and stop/play.
Thanks :)

0

to drag or upload the song into the list/Panel ...

Edited by StefanRafa0

0

or just add some songs from the code into the program and play it from there ...

Edited by StefanRafa0

0

I don't think that 'll do it. he's trying to drag something from his windows explorer into his java environment.
don't think awt has much notice about what files he has stored locally.

0

just show me how to add the songs into the JFrame and thats all no need drag and stuff just to show the name of the song which is playing at the moment ...

0

you can always use a JFileChooser to add them, just store them in a tracklist, and for the rest, just consider your tracks as Objects, with instance members:
String title
String artist
File localFile
...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.