Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Similar to this question, I would like to play a WAV file in a Java application - however, I would also like the ability to pause, resume, and restart the sound. I'm guessing I can restart by pausing and then just creating a new sound, but how would I pause and resume in the first place?</p> </blockquote> <p>The <code>javax.sound.sampled.Clip</code> would be ideal for this, <em>except</em> for the fact that most implementations of <code>Clip</code> will not load more than 2 seconds of stereo, 16 bit, 44.1KHz sound! For that reason I developed <a href="https://stackoverflow.com/questions/5667454/playing-audio-file-in-java-application/5668510#5668510">BigClip</a>. <code>BigClip</code> can handle sounds that are as big as the available memory.</p> <blockquote> <p>Note that my sound is ~15minutes and 152.8mb. If there is a way to do this with an MP3 file (same length, 20.8mb) that would be even better.</p> </blockquote> <p>Sure thing. As mentioned in the <a href="https://stackoverflow.com/tags/javasound/info">JavaSound tag info page</a>..</p> <blockquote> <h2>MP3 decoding support</h2> <p>The Java Sound API does not support many formats of sampled sound internally. In a 1.6.0_24 Oracle JRE getAudioFileTypes() will generally return {WAVE, AU, AIFF}. An MP3 decoder at least, is close by. The mp3plugin.jar of the Java Media Framework supports decoding MP3s.</p> </blockquote> <p>I currently use <code>BigClip</code> &amp; the mp3plugin.jar Jar in the DukeBox player. Given 1024Meg of memory, it can easily load both the 17:12 of the <em>1812 Overture</em>, &amp; 15:38 of <em>Bolero</em> (the two longest tracks in my favorites play list). I mention 'both' since it will load the next track while playing the current one.</p> <hr> <p>As an aside, beware of looking at code that mentions the <code>sun.audio</code> packages (mentioned in both linked threads). This package and/or it's classes might be moved or removed in the next release (at Oracle's discretion) &amp; have not been necessary since <strong>Java 1.3.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload