java sound without hardware device
Question
Anyone know if it is possible to write an app that uses the Java Sound API on a system that doesn't actually have a hardware sound device?
I have some code I've written based on the API that manipulates some audio and plays the result but I am now trying to run this in a server environment, where the audio will be recorded to a file instead of played to line out.
The server I'm running on has no sound card, and I seem to be running into roadblocks with Java Sound not being able to allocate any lines if there is not a Mixer that supports it. (And with no hardware devices I'm getting no Mixers.)
Any info would be much appreciated -
thanks.
Solution
For linux you can use OSS Virtual Mixer, which will give you virtual sound channels.
On windows there are a few sound drivers that do this, one is Virtual Audio Cable, which, while not free, is about the cost of a sound card so it shouldn't be a hardship.
If neither of those work for you, it'll probably be easier to make your own Java sound library and replace the built in functionality than it would be to implement a sound card for your OS.
-Adam
OTHER TIPS
All java needs are the drivers for a sound card. The JVM relies on the OS to handle direct hardware management, all JVM needs is a way to tell the OS that it wants a sound played (thus the driver).