Page 1 of 1

Make a noise in GAMS

Posted: Sat Sep 19, 2020 5:18 pm
by moosavi_69
Hello,

Is there any way to make a noise in GAMS at the end of a code (solving an MIP model)? I do not want to check the GAMS environment back and forth to see whether the solving process has been completed.

Best, Amir

Re: Make a noise in GAMS

Posted: Sun Sep 20, 2020 7:29 am
by bussieck
Never heard a request like this before... GAMS does not make noises but you can execute any program with execute. Here is a way to play a wav file (on Windows):

Code: Select all

...
solve mymodel us lp min z;
execute 'powershell -c (New-Object Media.SoundPlayer "C:\Windows\Media\notify.wav").PlaySync();'
-Michael

Re: Make a noise in GAMS

Posted: Sun Sep 20, 2020 12:55 pm
by mkbonde
You could also use the embedded code feature to run a python snippet - there are a bunch of text to speech libraries out there.

Code: Select all

$onEmbeddedCode Python:
    import pyttsx3
    engine = pyttsx3.init()
    engine.say("I will speak this text")
    engine.runAndWait()
$offEmbeddedCode