Playing sound with SAFR Actions on a PC
Playing a sound with SAFR Actions can be a challenge because Windows does not allow system services to interact with the sound devices. Sound device is considered an interactive device and is not meant to be controlled by a Windows Background Service.
To run a sound with SAFR Actions, SAFR Actions must be run on the command line using the syntax described in SAFR Actions Guide here: https://docs.real.com/guides/safr_actions/SAFR+Actions.pdf
C:\Program Files\RealNetworks\SAFR\jdk\bin\java.exe -jar ares.jar
This command will run the SAFRActions.config file located in following folder
C:\Program Files\RealNetworks\SAFR\ares
You can edit this file with a text editor or use the SAFR Actions Windows Application to edit it.
NOTE: You should turn off the Windows Service (and disable it so it does not resume at reboot).
Tip:
Experiment with the commands provided below to see which one you prefer in how to play a sound from Windows Command Line. Use Google for more information on this topic.
systemsounds.bat - plays standard windows sounds
References:
https://stackoverflow.com/questions/27079534/how-to-start-a-system-beep-from-the-built-in-pc-speaker-using-a-batch-file
https://github.com/npocmaka/batch.scripts/blob/master/hybrids/.net/systemSounds.bat
Sample code:
systemsounds asterisk
Available sounds: asterisk, beep, exclamation, hand, question
Python WinSound module
https://pypi.org/project/playsound/
Ref: https://www.geeksforgeeks.org/python-winsound-module/
Sample Code:
# loop iterates 5 times i.e, 5 beeps will be produced.
import winsound
for i in range(0, 5):
winsound.Beep(freq, dur)
freq+= 100
dur+= 50
# WinSound with input file:
import winsound
# winsound.PlaySound('filename', flag)
winsound.PlaySound('Welcome.wav', winsound.SND_FILENAME)