Voice alarm notification on cleint sound system

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:

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

  2. 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?

Ideas? Comments?

You will have to use RPC call to transfert the binary stream from gateway to client scope.
Sdk provide all you need for a client script fonction to execute code on the gateway and return the result to the client scope.

Then you can save the audio stream to a file in a client directory and play it.

Is this Vision or Perspective? If the former, use sendMessage() to deliver the bytes to the clients, and use playSoundClip in the client-side message handler.

Yea, Vision … so playSoundClip can work on the client. What about generating “the bytes” that playSoundClip can use? AudioSystem.write seems to take issue writing WAVE file bytes to an OutputStream.

No idea. I haven’t played with the voices.