Jump to content

Sound to the end of GOM ATOS Kiosk Interface measurement


---
 Share

Recommended Posts

Hello everyone,

I'm looking for a solution to add a sound to the end of a measurement in Kiosk mode to notify the operators of the end of the measurement before pressing the APPROVE button on the screen.

We have a large measurement room with other machines and there is no direct view of the screen and it is hard to tell if the measurement is finished, so some sound at the end would help.

Is this a possibility?

Thanks.

 

Link to comment
Share on other sites

Miro,

I've added sounds to a couple Python scripts outside of GOM, and I think the methods I used would still work within GOM's interpeter...

Method 1: Playsound module

from playsound import playsound

playsound('C:/Users/User/Music/sound.mp3') #Enter the filepath to your MP3 or WAV file as the argument

This is the easiest method I found, however keep in mind that the script will basically pause itself until the sound finishes playing, so if you have a long soundfile or place it somewhere other than the very end of the script, this may create a timing delay until the script finishes.

 

Method 2: Base64 Embedding into script

import base64, winsound


Encoded_TaDa_WAV = b'UklG.......' #Truncated for clarity, this is a base64-encoded byte string of a WAV soundfile that I've embedded in my script so that I don't have to relay on an outside file dependency
sound_file_data = base64.b64decode(Encoded_TaDa_WAV) #Decodes the base64 soundfile string at runtime
winsound.PlaySound(sound_file_data, winsound.SND_MEMORY) #Plays the decoded sound and immediately continues the script without waiting for the sound to finish

I switched to Method 2 in my program because I like the appeal of having the sound "built-in" to the script without requiring an outside file dependency, and because the Winsound module will play the sound and continue the script simultaneously. There are some online encoders that can convert files to base64, or you can do it within Python itself using the same base64 module. If you prefer to use Winsound without encoding the sound file I think it supports taking a WAV filepath as a different argument, it's just not how I chose to implement it.

Hope this helps!

Regards,
Michael Henson

Link to comment
Share on other sites

 Share

×
×
  • Create New...