Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Add music to applet?

 
may tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.. i have this coding in my applet..

{

AudioClip audioClip = getAudioClip(getCodeBase(), "17 Track 17.WAV");
audioClip.loop();

}
 
may tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. havent type finish my previuos qns..

okay i have the coding in my public void paint() method

{
AudioClip audioClip = getAudioClip(getCodeBase(), "17 Track 17.WAV");
audioClip.loop();
}

And also the follwoing html file in my "class" folder

<HTML>
<TITLE> Sound Demo APPLET </TITLE>
<APPLET CODE = "ComputeResistance.class" WIDTH=900 HEIGHT=1000></APPLET>
</HTML>

but why it doesnt seems to play any music?


Btw is it possible to add "4.17MB" song into my java?
will it hangs?

And what is the extension if it frm "window media player"??
is it .WAV?


Thanks =)
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. havent type finish my previuos qns..

You can edit any of your own posts by clicking on the icon (that looks like a paper and pencil) of the post you want to edit.

okay i have the coding in my public void paint() method
{
AudioClip audioClip = getAudioClip(getCodeBase(), "17 Track 17.WAV");
audioClip.loop();
}


but why it doesnt seems to play any music?

paint() is for visual, not audio. I would suggest using another method for this.

Also, you might want to rename the .wav file to one with no spaces (at least to start with). Also remember that Java is case sensitive. Is your wav file really in all caps?

Btw is it possible to add "4.17MB" song into my java?
Will it hang?


After you get the small wav running, you can try with a larger file.

And what is the extension if it from "window media player"??
is it .WAV?


It depends on the operating system. Windows media player does indeed play wav files, but whether or not it is the default is system dependent.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic