If you have timing problems and bad sound with midi, you’ve most likely “forgotten” to install a soundbank (sdk comes with and jre without).
http://java.sun.com/products/java-media/sound/soundbanks.html
And sampled sound… well, there are several ways for playback. Applet’s AudioClip stuff for example performs generally very poor, because the audio data get stored in ram the first time a sample is played (and your game is usually already running then).
What works quite ok-ish is using Clips (not Applet’s of course). The audio data is then already stored in ram and there is no delay (well ok maybe 50msec) if they are played. At the very first time a sample is played there is a small delay, if you hadn’t created a mixer first (the default mixer is then created and everything is fine).
[search for “SoundManager” to get some example code]
That works quite well, but it’s only suitable for rather short samples (eg 150 300-1500msec sfx samples). For background music you usually need something else (streaming).
With OpenAL it’s similar - decode, put it into ram and playback whenever you want to. It’s very fast and you can only use good methods there (all that silly stuff was omitted ;)).
Edit…
Is that working properly on Linux as well as Windows?
Yep, and on Mac, too