AdvancedHMI Software

General Category => Tips & Tricks => Topic started by: Archie on June 27, 2013, 07:07:52 PM

Title: Hear Your Alarms, not just an annoying buzzer
Post by: Archie on June 27, 2013, 07:07:52 PM
The MessageDisplayByValue has a property named SpeakMessage. If this is set to true, then each time there is a new message, it will be spoken through the PC speakers. If you wish to get creative, you can find various voices for download on the internet.
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: BLFTech on August 20, 2013, 06:14:05 PM
Does this control allow the adding of alarms from a file at runtime?
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: Archie on August 20, 2013, 06:31:18 PM
The MessageDisplayByValue has a property named INIFileName that is used to set up alarms from a text file. This is an example of how the file is formatted:

0,CONTROL OFF
1,20F6/ 24VDC SUPPLY POWER OFF
2,20F8/ 24VDC SUPPLY POWER OFF
3,EMERGENCY STOP
4,46Q1/ CIRCUIT BREAKER FEEDER


This is how I typically use the file feature:

1) Add a text file to the project and name it Alarms.txt
2) Type in the alarms as shown above
3) Set the INIFilename to .\alarms.txt
4) Then set the property "Copy to output directory" of the text file to Copy if Newer
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: BLFTech on August 20, 2013, 07:23:06 PM
Thanks Archie, that works nicely.

I also added the code from another thread to log the alarms on a text change event and for some reason it logs data almost continuously. Any ideas why the textchange event would trigger without the text changing?
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: Archie on August 20, 2013, 09:40:22 PM
I also added the code from another thread to log the alarms on a text change event and for some reason it logs data almost continuously. Any ideas why the textchange event would trigger without the text changing?
I found a problem with the way it built the message that caused the event to fire every time data was returned from the PLC. I put in a fix for the next release.
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: ijones on November 18, 2013, 09:53:19 PM
I realize this thread is a couple months old but was wondering if I am doing something wrong.
I have the message speaking to me, but.. it appears that it is storing triggers each time it gets data from the plc (using modbustcp if that makes any difference) and will repeat the same message as long as it takes to speak it as many times as it was triggered from the plc even though the plc may have changed the value and a new message is now supposed to be heard.
The text for the message changes instantly as it should but it continues to speak the old message until it goes through the number of times it received it from the plc then starts speaking the new message the number of times it was received! I can see where in a very short time it could take forever to go through the numbers of triggers that are stored... Any ideas?

Fun stuff!!
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: Archie on November 19, 2013, 05:45:55 AM
I have the message speaking to me, but.. it appears that it is storing triggers each time it gets data from the plc (using modbustcp if that makes any difference) and will repeat the same message as long as it takes to speak it as many times as it was triggered from the plc even though the plc may have changed the value and a new message is now supposed to be heard.
The text for the message changes instantly as it should but it continues to speak the old message until it goes through the number of times it received it from the plc then starts speaking the new message the number of times it was received! I can see where in a very short time it could take forever to go through the numbers of triggers that are stored... Any ideas?
I'm not sure if there is a way around this. The voice messages run asynchronously and cued up, so if your messages change faster than they can be spoke, it will become an issue.

I will test some things out to see if I can resolve this
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: oqapsking on May 08, 2017, 10:49:01 AM
how to use the speak thing?

how to set it up ?
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: Phrog30 on May 08, 2017, 11:04:16 AM
how to use the speak thing?

how to set it up ?

All you really need is this:
Code: [Select]
Private Sub Alarm_Speech()

        Dim SAPI = CreateObject("SAPI.spvoice")
        SAPI.Speak(alarmName)

    End Sub

"AlarmName" is the string/text
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: Archie on May 08, 2017, 11:13:32 AM
In the MessageDisplayByValue, set the SpeakMessage property to True.
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: oqapsking on May 08, 2017, 01:46:52 PM
I set it to true
Now i have file alarm1.mp3 i want it to play when alarm value is 1
How should i write the code?
Title: Re: Hear Your Alarms, not just an annoying buzzer
Post by: Archie on May 08, 2017, 01:49:57 PM
You want the SoundPlayer component. That plays a file on a bit to trigger it.