Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
I'm not a python programmer so I was wondering if I could get any tips on how to modify the python command to be able to play a random sound. I'm open to using dirty tricks like having the audio files named sequentially etc, as long as it works
from os import listdir
from os.path import isfile, join
import random
#path you want to get wav files from
path = "C:\Windows\Media"
onlyfiles = [ f for f in listdir(path) if isfile(join(path,f)) ]
onlywavfiles = []
for f in onlyfiles:
if f[-3:] == "wav":
onlywavfiles.append(f)
#generate random number based on number of available files
randomnum = random.randint(0,len(onlywavfiles)-1)
eg.plugins.System.PlaySound(path + "/" + onlywavfiles[randomnum], 1, False)
I like this script very much - I have used it for my burglar alarm. Whenever my PIR outside the house goes off a random dog barking sound goes of inside
My problem is that the wav files a very bad quality and the barking does not sound very realistic. Is there any posibility to make a script that plays .mp3 files - they are very realistic and scarry?
I have tried just pointing the directorry and changing .wav to .mp3 but this doesent work....
Henrik4223 wrote:I like this script very much - I have used it for my burglar alarm. Whenever my PIR outside the house goes off a random dog barking sound goes of inside
My problem is that the wav files a very bad quality and the barking does not sound very realistic. Is there any posibility to make a script that plays .mp3 files - they are very realistic and scarry?
I have tried just pointing the directorry and changing .wav to .mp3 but this doesent work....
The easiest way would be to convert the mp3s to wav
I have an RFXtrx and the RFX plugin for Eventghost.
I have found these (http://www.ebay.com/itm/311479916789?_t ... EBIDX%3AIT) very cheap (and SMALL and works perfectly - no false events so far and free shipping ) PIR sensors from China that works together with the RFXtrx out of the box. They send both movement and battery status in the event from RFXtrx.