Skip to main content
Is it possible to add transfomer with PC sound notification? Eg. If unexpected path event was detected or a scound notification to the data inspector new window opening?

You can set sounds under Tools, Options, Appearence, Advanced Options, Configure Sound Events...

If you need more specific / custom stuff you can use a SystemCaller to start anything you want :)


If you're on Windows, you can use two lines of code in a PythonCaller, e.g.

import winsound
winsound.MessageBeep()

This will trigger the sound file that is associated with the "Default Beep" event in the Windows sound settings:

imageMore info here: https://docs.python.org/3/library/winsound.html


If you're on Windows, you can use two lines of code in a PythonCaller, e.g.

import winsound
winsound.MessageBeep()

This will trigger the sound file that is associated with the "Default Beep" event in the Windows sound settings:

imageMore info here: https://docs.python.org/3/library/winsound.html

import winsound
 
class FeatureProcessor(object):
 
    def input(self, feature):
        frequency = 2500 # Set Frequency To 2500 Hertz
        duration = 100 # Set Duration To 1000 ms == 1 second
        winsound.Beep(frequency, duration)
        self.pyoutput(feature)

Working sample for the not Python experts like me:)


import winsound
 
class FeatureProcessor(object):
 
    def input(self, feature):
        frequency = 2500 # Set Frequency To 2500 Hertz
        duration = 100 # Set Duration To 1000 ms == 1 second
        winsound.Beep(frequency, duration)
        self.pyoutput(feature)

Working sample for the not Python experts like me:)

Let's delete the default comments and keep the default functions.

 

This script plays a different sound (length) when groups exit the transformer, so it sounds like morse.

 

import fme
import fmeobjects
import winsound
 
class FeatureProcessor(object):
    freq = 2000
    duration = 100
    groupfreq = 2000
    groupduration = 300
 
    def __init__(self):
        pass
 
    def input(self, feature):
        winsound.Beep(self.freq,self.duration)
        self.pyoutput(feature)
 
    def close(self):
        pass
 
    def process_group(self):
        winsound.Beep(self.groupfreq,self.groupduration)

 

 

 

 


import winsound
 
class FeatureProcessor(object):
 
    def input(self, feature):
        frequency = 2500 # Set Frequency To 2500 Hertz
        duration = 100 # Set Duration To 1000 ms == 1 second
        winsound.Beep(frequency, duration)
        self.pyoutput(feature)

Working sample for the not Python experts like me:)

And the most minimalist version that works:

import winsound
winsound.MessageBeep()
def FeatureProcessor(feature):
    pass

Because you have to set a Class or Function to Process Features. And this Class or Function has to accept the 'feature' object.

 

But be aware that this only plays sounds if you have your system sounds enabled.

Else the Beep(2000,100) and not the MessageBeep() would be the way to go.

 

 


Thank you.


import winsound
 
class FeatureProcessor(object):
 
    def input(self, feature):
        frequency = 2500 # Set Frequency To 2500 Hertz
        duration = 100 # Set Duration To 1000 ms == 1 second
        winsound.Beep(frequency, duration)
        self.pyoutput(feature)

Working sample for the not Python experts like me:)

Lol, I think you should create an idea for a MIDI file reader ;-)


Reply