The title basically tells my story, I would like to send audio directly to the speaker system from a java program, i was thinking of trying to write directly to the speakers in /dev/ in linux using bytes obtained from an audio file, which i'm not sure would work, but in Windows i'm beyond stumped. I was thinking along the lines of something like this:
public void play(byte[] audio){
if(OS.isWindows){//This is where i have no idea, maybe write to javasound with jmf?
}
if(OS.isLinux){
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream("/dev/blahblah");
bout.write(audio)
bout.flush();
bout.close();
}
My code almost seems to simple to me, not that i want complicated code, but i want working code. I havent actually tried the above code, in fear that i dont know what im doing, and could possibly hurt or interrupt something in my pc.