1. | I'm a total newbie with Java Sound. Where can I get some code
examples? |
| Have a look at the Java Sound Resources: Examples. Some small code snippets can be
found in the Java Developers Almanac: javax.sound.sampled examples -
javax.sound.midi examples. Another possibility (rather for advanced users) is to download
the JavaSoundDemo from Sun's Java
Sound Homepage. (Matthias) |
2. | Where can I ask questions on Java Sound? |
| The question you have may have been answered
already. Please check the following resources: If you decide to ask a new question, it is recommended
to follow best practise in describing your problem. Some hints
can be found at Java Sound Resources: Contact: Question Guidelines and Sending
Messages to javasound-interest (Matthias) |
3. | Where can I ask questions on Java that are not related
to Java Sound? |
| Search the Sun website: Java(TM) Technology Site
Search. (Matthias) |
4. | Why do I get "Exception in thread 'main'
java.lang.NoClassDefFoundError:" when trying to run my first
Java Sound program? |
| Welcome to Java! The way to invoke the Java Virtual
Machine is 'java SimpleAudioPlayer sound.wav', not 'java
SimpleAudioPlayer.class sound.wav'. This behaviour is not
specific to Java Sound. (Matthias) |
5. | What do I need to compile programs that use the Java
Sound API? |
| There are three possibilities: Use a JDK version 1.3 or newer. Use an older JDK (e.g. JDK 1.2.2 or even JDK 1.X)
and install JMF
2.X performance pack. Use an older JDK and install an alternative Java
Sound implementation (e.g. JDK 1.2.2 and Tritonus).
(Matthias) |
6. | Is it possible to program a telephony application with
Java Sound? |
| It is possible. We cannot provide all concepts of
digital audio in this FAQ. There are many good books on this
subject. I recommend "the computer music tutorial"
from Curtis Roads, from MIT press. For simple examples how to
do streaming audio with Java Sound, see the Java Sound Resources: Examples. For streaming audio (and possibly video), have a look at
Java
Media Framework (JMF). It provides a high-level API
with streaming protocols and codecs. See also next
question. (Florian) |
7. | How is the JMF related to Java Sound? |
| The Java Media
Framework (JMF) is a high-level API, designed mainly
for easy playback of multimedia files, video as well as
audio. Java Sound, on the other hand, is a rather low-level
API, designed for detailed control of the audio and MIDI
hardware. The 'performance pack' versions of JMF use Java Sound to
play and capture sound data. Because of this, they include the
Java Sound implementation. This implementation is the same as
in the JDK (but sometimes a bit newer). The 'all-java' version
of JMF uses sun.audio classes to
playback sound (capture is not possible here). So this version
doesn't include a Java Sound implementation. JMF has several features that Java Sound doesn't
have: Much more codecs Support for synchronization between media
streams, for instance syncing audio and video
playback Support for streaming protocols like the
Real-time protocol (RTP)
The advantages of using Java Sound are: Regarding applets, JMF is easier to use. This is because
JMF can run on JDK 1.1. This means that JMF can run on older
browser VMs. In opposite to that, Java Sound requires either
JRE 1.3 or higher and a browser that can use the system's VM
or the Java plug-in 1.3 or higher. (Matthias) |
8. | What should I do if I want a specific feature in future
versions of the Java Sound API? |
| You can make specification requests to Sun. To read how
to do that, go to http://java.sun.com/aboutJava/communityprocess/submit.html.
You may want to discuss the feature on the javasound-interest
mailing list before. (Florian) |
9. | Why are many things specified in the Java Sound API not
implemented? |
| This is a matter of time. Sun will improve the Java
Sound implementation (and also the API). Other people will
provide service providers to extend Java Sound. The Tritonus team will
release parts of Tritonus as service providers so that
everybody can take advantage of Tritonus' achievements. A
native port of Tritonus to Windows is planned,
too. (Florian) |
10. | What should I do if I discovered a bug in a Java Sound
implementation? |
| For the Sun implementation, you can submit it as a bug
on http://java.sun.com/cgi-bin/bugreport.cgi
(needs a registration to the developer connection). See also
the list
of open bugs. To get a bug fixed soon, you can put
your votes on it and encourage others to do so. For Tritonus, use their bug
reporting system on http://sourceforge.net/bugs/?group_id=1390.
(Florian) |
11. | What should I do if I have a problem
with Java Sound on Mac OS or Mac OS X? |
| Apple is responsible for the Java Sound implementation
on their operating systems. So if you need a feature there,
bug Steve Jobs. (Matthias) |
12. | What's new in the JDK 1.5.0 with respect to Java
Sound? |
| See Java
2 SDK, Standard Edition, Version 1.5.0 Summary of New Features
and Enhancements - Java Sound Technology.
(Matthias) |
13. | Is the source code of Java Sound available? |
| For the Sun implementation of Java Sound, you can get
the JDK source code under the Sun Community Source License
(SCSL). See Sun
Community Source Licensing. For the Tritonus implementation of Java Sound, you can get
the source code under the GNU Library General Public
License. See Tritonus. See also Q: 8
(Matthias) |
14. | Is Java Sound available on J2ME / MIDP / Personal
Java? |
| No. However, there is the Mobil Media API
(MMAPI), which is developed for J2ME. The "audio
building block" of MMAPI is also part of MIDP 2.0. The design
of MMAPI is similar to JMF. (Matthias) |
15. | How is Java Sound related to the Java3D sound
API? |
| A quote from Warren Dale, Java 3D Team, Sun
Microsystems: Java 3D 1.2 API will accept
InputStreams including those created
for Java Sound objects, and at least one Java 3D
AudioDevice3D interface will use the
JavaSound API to render Java 3D sound objects, but that is
the extent of the planned relationship between these two
packages. An application will eventually be able to
create/manipulate both Java 3D and Sound objects on the same
device, but there are currently a few limitations (holes) in
mixing API calls using the same audio device (some resource
management issues have yet to be resolved). Interaction
between the two a will be more robust over time.
(Matthias) |
16. | Can I do speech recognition with Java Sound? |
| You can, but propably not the way you have in mind. The
Java Sound API provides you with the facility to record
audio. Everything needed to process this audio data to get
text from it has to be done yourself. Obviously, it is
possible to code that in Java. However, if you just want to
call some methods, use the Java Speech
API (JSAPI). See also Q: 4 (Matthias) |
17. | What is the status of Java Sound on
Mac OS X? |
| The lastest available release of the JDK for Mac OS X is
version 1.4.2. When or if Apple will release a 1.5 version is
unknown. With the current release (1.4.2), audio is reported
to work ok with good overall latency. MIDI is not
implemented. However, you can use the plum-stone
project to access MIDI devices (not as a
sequencer). Apple also provides direct access to its
"coreaudio" library via a Java packet
com.apple.audio. Obviously, using this
packet rather than the Java Sound API will make your program
non-portable. See also What should I do if I have a problem
with Java Sound on Mac OS or Mac OS X? (Matthias) |
18. | Where can I find javadocs on the
javax.sound.* classes? |
| The Java Sound documentation is part of the
documentation bundle of the JDK. You can download
it or view it online.
(Matthias) |