Haiku Helper and Serial Port Communications

jmorris644

Active Member
I was reviewing the API docs specifically for the serial port control. I saw that it references serial ports on the Mac. Is there any way to communicate to the serial ports on the OPII?
 
I am really attempting to create a paging function through the OPII using Helper as Lupinglade and I discussed in a HAI topic. (I wanted to bring this topic here is it was OT in the other thread.)
 
Joe
 
Are you sure you need to send serial commands through the Omni? Could you explain exactly what you are trying to do?
 
Sure. Currently the Nuvo Essentia is connected to the Omni. I want to start using the paging capabilities. You had mentioned in another post in the HAI section that I should look at using Helper to create a paging "system" (my word). Rather than me making assumptions on how to communicate with the Nuvo for this purpose maybe you can just point me in the correct direction?
 
Joe
 
Okay, there is a much easier/better way of doing this.

You will need to connect a mini-RCA connector between the paging input on the Essentia G and a 12v Output trigger on the Omni.

Next, connect the audio output from your Mac running HaikuHelper to the input for the paging zone on the Essentia G (usually zone 6).

Then you can add this to your HaikuHelper script:
Code:
function onStartSpeaking() {
    controller.unitWithNumber(25).on();
}

function onStopSpeaking() {
   controller.unitWithNumber(25).off();
}
Replace 25 with the number of the Output you connected to the paging input on the Essentia G.

Now you can do this:
Code:
helper.speak(controller, "This is a test");
And you should hear it page the message.

If you want to use pre-recorded, one way would be to add the pre-recorded messages to iTunes and play them from HaikuHelper via the AppleScript functions. You will need to turn on the output of course before playing the recording. I will see if we can add WAV playback right into HaikuHelper for the next update or the one after.
 
Yes, this was my initial plan. I may have misunderstood what you were trying to tell me in the HAI thread. I will get this going today.
 
The reason I was looking at pre-recorded was I am looking at some different text to speech software and thought I might like a nice british or australian accent.
 
I will get this going and let you know how it works out.
 
Two more thing though, from my research I will need a 1-2 second delay between turning the output on and sending the audio. Also, I use my Mac mini to run my home theater hence the audio out is always set to the hdmi port. Can I specify in the script which audio out to use? Or at least change it and then change it back?
 
Thanks. You are extremely helpful.
 
Joe
 
I think you can get british/australian/etc accents with the built in TTS. It will give you so much more flexibility as your messages can be dynamic, instead of just a fixed number of pre-recorded messages. For example you could even do the weather forecast with the built in TTS.

HaikuHelper has a helper.setSpeechDelay(x) method, where x is a number in milliseconds, so you could use helper.setSpeechDelay(2000). You only need to set this once at the beginning of the script.

Unfortunately I'm not sure about changing the output, you may need to do it using an Apple Script that HaikuHelper runs. I don't know how reliable that would be. Is it possible to maybe set the output to both HDMI and the RCA connectors? Or maybe make the audio pass through the home theatre hardware and back to the Essentia G paging zone input?
 
Version 2.75 will add:

helper.speakSound(controller, soundfile) - Plays a sound as part of a speech queue (ie. before, after or inbetween speak() commands)
helper.playSound(soundfile) - Plays a sound asynchronously
helper.setSpeechStartDelay(x) - Set the initial delay when starting to speak to let audio system warm up (separately from the speechDelay, which is the delay between speak() commands being spoken)
 
Back
Top