Question

How long of a .wav file is a Clip supposed to play? This method only works for short files (like <2 secs). Playing MP3 using Java Sound API and How do you play a long AudioClip? show how to play long audio files, but how long of a file was a Clip meant to play?

Was it helpful?

Solution

..how long of a file was a Clip meant to play?

'Short'. It has never been defined explicitly. In some non-Oracle/Sun VMs it depended only on the size of available memory (I was originally developing an app. using Clip to load large sound files on an Ubuntu OS using a non-Sun JRE, and was most irritated to discover it would fail completely when using Sun's).

As far as the Sun/Oracle JRE goes, my last testing suggested the 'size' was not inherently the duration of the clip, but the amount of sound data that was loaded (once resolved to PCM). I.E. a mono, 8 bit sample at 11.025 KHz could be 16 times longer in duration than another that was encoded as stereo, 16 bit at 44.1KHz. Bottom line..

The Oracle JRE could load exactly 1 second of stereo/16 bit/44.1 KHz. Not suited to playing a typical MP3, so that is when I developed BigClip.

And I now notice that info. on 'size' was given in one of the linked questions..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top