scvoice

This tool runs an external script whenever an event has been created or updated. It can also run a script in case an amplitude of a particular type or a preliminary origin (heads-up message) has been sent. The common purpose for this tool is to play a sound or to convert a message to speech using external tools like festival or espeak. There are three possible script calls:

Although this tool was designed to alert the user acoustically it can also be used to send e-mails, sms or to do any other kind of alert. scvoice can only run one script per call type at a time!

Options

scvoice supports commandline options as well as configuration files (scvoice.cfg).

Commandline

--first-new
Declares an event as new event when it passes scvoice the first time. This influences the following parameter when calling the event-script. When the event first passes scvoice it is handled like a new event regardless whether it is an updated or a new event.
--amp-type <double> (=snr)
Specify the amplitude threshold. Whenever an amplitude with an SNR equals to (or greater than) the threshold has been received the amplitude script will be called if configured.
--amp-script <parameter list>
Specify the parameters passed to the script when an amplitude with a defined type has been received. Network and station code and amplitude are passed as parameters 1, 2 and 3. Example:
amp-script GE STU 12.34
--alert-script <parameter list>
Specify the parameters passed to the script when a preliminary origin has been received. Latitude and longitude of the origin are passed as parameters 1 and 2. Example:
alert-script 6.78 -123.45
--event-script <parameter list>
Specify the parameters passed to the script when an event has been declared or updated. A message string, a flag (1=new event, 0=update event), the event-id, the arrival count and the magnitude (optional when set) are passed as parameter 1, 2, 3, 4 and 5. Example:
event-script "earthquake, 8 minutes ago, Southern Sumatra, Indonesia, magnitude 6.0, depth 10 kilometers" tst2008abcd 10 6.0
--max-dist <integer>
When using the nearest point of interest (city) as part of the message string, specify the maximum distance in degrees from the event. Any point of interest farther away will be ignored. The default value is 20.
--min-population <integer>
Specify the minimum population for a city to become a point of interest. The default value is 50000.
-E, --eventid <id>
This parameter is for debugging and test only. If an existing event-id is given the event-script will be called immediately. Then the application will continue as normal.

Configuration

Users configuration file: $HOME/.seiscomp3/scvoice.cfg

firstNew = <bool>
Same as --first-new. TRUE enables the flag, FALSE disables it.

poi.message = <string>
The default message string for the event-script is “earthquake, [HOURS] hours [MINS] minutes ago, [DESC], magnitude [MAG], depth [DEP] kilometers”. Whereas [DESC] is the string given in the event.description attribute. This string can be overwritten using one of the following options. There are three placeholders that can be used:

placeholderdescription
region Replace by the region string of the origin location.
dist Replace by the distance in kilometers to the nearest point of interest if available.
poi Replace by the name of the nearest point of interest if available.


Example:

poi.message = "@region@, @dist@ kilometers from @poi@ away"
poi.maxDist = <float>
Same as --max-dist.
poi.minPopulation = <integer>
Same as --min-population.
scripts.amplitude = <string>
Same as --amp-script.
scripts.alert = <string>
Same as --alert-script.
scripts.event = <string>
Same as --event-script.

Examples

Event script:

#!/bin/sh
if [ "$2" = "1" ]; then
echo " $1" | sed 's/,/, ,/g'   | festival --tts;
else
echo "Event updated, $1" | sed 's/,/, ,/g'   | festival --tts;
fi

Save this script e.g. under /home/sysop/.seiscomp3/event.sh and add it to the configuration file /home/sysop/.seiscomp3/scvoice.cfg.

scripts.event = /home/sysop/.seiscomp3/event.sh

Amplitude script:

#!/bin/sh
# Play a wav file with a particular volume
# derived from the amplitude itself.
playwave /home/sysop/.seiscomp3/beep.wav -v $3

Save this script e.g. under /home/sysop/.seiscomp3/amplitude.sh and add it to the configuration file /home/sysop/.seiscomp3/scvoice.cfg.

scripts.amplitude = /home/sysop/.seiscomp3/amplitude.sh

Alert script:

#!/bin/sh
playwave /home/sysop/.seiscomp3/siren.wav

Save this script e.g. under /home/sysop/.seiscomp3/alert.sh and add it to the configuration file /home/sysop/.seiscomp3/scvoice.cfg.

scripts.alert = /home/sysop/.seiscomp3/alert.sh