I’m trying to write a rendered voice message to an OutputStream, and then run playSoundClip on that at the client. The goal is to use the client machine’s sound system for alarm notifications.
strm = ttsMgr.getTalkerFor(voiceToUse).render(alarmMessage) s = ByteArrayOutputStream() bytes = AudioSystem.write(strm, AudioFileFormat.Type.WAVE, s) system.util.playSoundClip(s.buf, 1.0, True)
I left out the code to instantiate ttsMgr and voiceToUse, but If AudioSystem.write’s to File instead of a stream, I can playSoundClip and hear the message on the gateway machine’s sound system; so we’re close.
My goal is to continuously (on some client timer script interval) voice notify each unack’d alarm to each running client. And I don’t want to have to deal with generating and managing files on disk.
I have the following issues:
AudioSystem.write IOException when writing to an OutputStream; probably due to a missing byte length in the WAVE data header. Some I’m looking for some workaround.
playSoundClip seems to only run on the gateway, so getting katherine’s voice to the client is a problem. Maybe there’s a workaround for this?