it is quite possible to create procedual instruments, if
you are prepared to spent $299.
In yet another big mistake made by SUN they decided to use proprietary technology to try and improve Java, rather than use open standards.
This is not the first time they've done this and it wont be the last (deciding not to use OpenGL, was another big mistake - although this appears to be a spat between the Java Community Process [JCP] and the ARB).
Of course I would argue that this would never have happened if Java was Open Source in the first place, but then Java is very much product (it wont ever be open source unless IBM buys SUN) and is the only thing that keeps SUN visible in the computer market place (Java this, Java that, J-blahblah).
No hires timer, only mono support for 8Khz .au files in Java 1.1.4, the list goes on.
This behaviour seem to be on purpose too, because they are just not address the issues relevant to game developers. Sure they've always got something round the corner... This is called vapourware!
It's interesting to note that Microsofts J++ allows access to Direct X, but sun still haven't got things sorted out to an equivalent level.
Does Java support 24bit audio? Does it support 96Khz? Does it support > 32 channels? Will it ever? Not that its got the processing power to use it.
Have they fixed the audio latency problem yet? No, of course this could very well be classes as not possible due to audio being classified as "Hard Real Time", in that any slight pause will cause the audio stream to stop and cause crackling and stutters.
Hard real time applications are very difficult to do in Java, which is why there is a LARGE audio buffer to stop the crackling, this is not helped by Javas poor timing, in both threads and system clock ms accuracy is FAR to low we should be having Mhz timing not some pathetic sub 1 Khz range.
Anyway I'm sure your not that interested in all this so what you need to be doing is creating a RMF
file, which is capable of storing both music and instruments of your own creation. You can then just open it like a standard wave file to play in Java.
They still have latency problems though apparently (50-100ms), and from the sun examples I've played with they have timing problems too. But I could hardly say I'm an expert in using them so have a play around yourself rather than taking my word.
Do a search in your JDK/SDK (not JRE) for *.RMF files, there will be a demo for you to try:
SDK 1.3 : There is a Java2D demo containing RMF playback, look for the mix tab (bottom left) "Java Media".
JDK 1.2.1 : Had a separate JavaSound.class demo, that requires running with java demos.Mix.JavaSound
It's quite simple to use (if memory serves correct), something like:
URL url = JavaSound.class.getResource( name );
clip = Applet.newAudioClip(url);
In order to create RMF files you will need the Beatnik Editor
The trial version will not save RMF files. The Beatnik Editor is the only piece of software that will allow you to create RMF files (unless things have changed radically since I last looked).
The sound channels (all 32 of them) are at least mixed natively, so you will actually be able to do other things whilst it is playing.
Personally I'd try an XM player, which Beatnik is based on anyway and they are either free or shareware. It's also an open standard so you can write your own player if you so wish.
There are also plenty of Midi to XM converters floating around.
P.S. This sounds like trolling, but the only way to get SUN to fix it is to get on their back. Have they changes anything since the Java Media Framework implementation??? No.
P.P.S. You don't have to go far to find someone having difficulty implementing JavaX.Sound.