Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java sound without hardware device

Tags:

java

audio

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.

like image 572
rory Avatar asked Apr 02 '26 06:04

rory


2 Answers

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

like image 172
Adam Davis Avatar answered Apr 03 '26 21:04

Adam Davis


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).

like image 39
cblades Avatar answered Apr 03 '26 21:04

cblades



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!