Loading Sounds
Much of what has been said for loading images also applies to loading sounds. There are just a few differences, however:
Currently, sound support is tied to applets only. That means that stand-alone programs can not read or play a sound clip (unless they use an additional package available for free from SUN). Images can be used in applets and stand-alone programs. | |
Sounds can not be added to the current version of the MediaTracker. SUN will hopefully remedy that situation soon. The getAudioClip method, as the getImage method, will return immediately. It is somewhat unclear to me what exactly happens, when the sound starts loading, whether the sound can be played 'incrementally', or whether a 'play' method will block until the entire sound clip is downloaded, then start playing. Sound support seems to be not as well developed (and documented) as image support so far, sorry. | |
The only sound format currently supported is 'au' format from SUN. That means that WAV or Mac sounds need to be converted to SUN's 'au' format before they can be used by an applet. I have found that many sound converters promise to create true SUN au files, but often they were not acceptable to an applet. The best sound converter is a Unix program called 'sox'. It is fast, has no graphics interface (hence is fast) and converts pretty much anything into everything. |