[Feature Request] Mac OS
Can you make the play sound ACTION be configurable to play a different sound file for each motion type?
motion
animal
human
vehicle
Comments
-
This is possible with an AppleScript, as follows:
on run args set reason to item 3 of args if reason contains "Human" then do shell script "afplay /System/Library/Sounds/Morse.aiff" end if if reason contains "Vehicle" then do shell script "afplay /System/Library/Sounds/Frog.aiff" end if if reason contains "Animal" then do shell script "afplay /System/Library/Sounds/Ping.aiff" end if end run
Copy and paste this code into a new document in Script Editor, and save the script to the ~/SecuritySpy/Scripts folder (i.e. the Scripts folder within the SecuritySpy folder within your Home folder). This script will then become available as an Action that can be selected for any camera. Look in the folder at /System/Library/Sounds for available system sounds that you can use.
-
Thanks will check it out
-
And if I wanted to use non system sounds, what would I change it to?
-
I just change the audio file path?
-
Yes, you would edit the path to point to the file you want to be played. You can use any sound file in any standard format (aiff, mp3, m4a, wav etc.) Simply locate the sound file on your drive and drag it into the Script Editor window and the path will be printed there. Subsequently, don't move the file to a different location on the disk, otherwise it won't be found by the script.
-
Any way to set audio volume per type in the script?
-
As a side note, there is the built-in "say" command which might give you some more interesting ways to send alerts with data embedded into them without building specific sound files.
For instance:
do shell script "say alert alert a human was detected"
-
I use the the built in speaker of the mac mini to play a sound if a human is detected after the sunset. I keep my phone silenced and rely on the sound played on the mini to decide whether to check my phone or not.
-
The afplay command can accept a volume parameter, as follows:
afplay -volume 1.0 path
It seems that 1.0 means "full volume" - specify a value below this for quieter playback or above this for louder (boosted) playback, though the scale is not linear and you'll have to do a bit of trial an error here to find the right numbers for your sounds.
-
kk ill test it out , thank you
-
I modified this to change the volume of the iMac it plays on and also to restrict the time of day it says the announcement. I specified to use the voice Karen but you can change this name to any other voice you download on your Mac under system preferences, Accessibility , Spoken Content
on run args
set volume output volume 60
set rightNow to (get current date)
set hoursNow to hours of rightNow
set reason to item 3 of args
if reason contains "Human" then
if (hoursNow ≥ 0) and (hoursNow ≤ 4) then
say "A person is at the front door." using "Karen"
end if
if (hoursNow ≥ 6) and (hoursNow ≤ 24) then
say "A person is at the front door." using "Karen"
end if
end if
if reason contains "Vehicle" then
do shell script "say a vehicle was detected"
end if
if reason contains "Animal" then
if (hoursNow ≥ 7) and (hoursNow ≤ 20) then
say "Animal at the front door." using "Karen"
end if
end if
end run
