TheOne23 Posted May 21, 2021 Share Posted May 21, 2021 Hi Everyone, I would like to ask if someone have an idea how to mute sound from a specific AutoIT script that uses text to speech. For example if I am using script below and wanted to mute the sound only on this process how can I do that if Send({Volume_mute}) mutes the entire Volume of the system. Global $oSp = ObjCreate("SAPI.SpVoice") Global $voice = "Zira" While 1 sleep(500) $oSp.voice = $oSp.GetVoices("Name=Microsoft " & $voice & " Desktop", "Language=409").Item(0) $oSp.speak("This is a testing!") WEnd Thanks in Advance AutoIT friends. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 21, 2021 Developers Share Posted May 21, 2021 (edited) Doesn't SAPI.SpVoice have an option for that? Something like "$oSP.volume = 0 ; mute" ? Edited May 21, 2021 by Jos FrancescoDiMuro 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheOne23 Posted May 21, 2021 Author Share Posted May 21, 2021 Hi Jos, Thank you for the information. I actually figured that out last week and got this one created. I would like to make it an instant mute and unmute if possible. expandcollapse popupGlobal $Button3_value, $vol Global $Radio3,$Radio4,$Button3 Global $oSp = ObjCreate("SAPI.SpVoice") #Region ### START Koda GUI section ### Form=d:\automations\emilia volume\emilia_volume.kxf $Form1_1 = GUICreate("EMILIA", 255, 72, 537, 170) $Control = GUICtrlCreateLabel("Emilia Controller", 8, 8, 152, 25) GUICtrlSetFont(-1, 14, 800, 0, "MS Serif") $Button3 = GUICtrlCreateButton("Voice Rate", 168, 32, 81, 33) $Radio3 = GUICtrlCreateRadio("Mute", 8, 40, 65, 17) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Radio4 = GUICtrlCreateRadio("UnMute", 72, 40, 89, 17) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 ;~ sleep(1000) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio3 ;GUICtrlRead($Radio3) = 1 ; Mute $vol = 0 Case $Radio4 ;GUICtrlRead($Radio4) = 1 ; UnMute $vol = 100 Case $Button3 $Button3_value = InputBox("Voice Rate","Input Voice Rate Speed: ") EndSwitch ;sleep(500) _speak("This is a Testing!",$Button3_value,"Zira",$vol) WEnd Func _speak($text,$rate,$voice,$volume) $oSp.voice = $oSp.GetVoices("Name=Microsoft " & $voice & " Desktop", "Language=409").Item(0) $oSp.rate = $rate $oSp.volume = $volume $oSp.speak($text) EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted May 21, 2021 Developers Share Posted May 21, 2021 Just set the volume with an hotkey? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheOne23 Posted May 21, 2021 Author Share Posted May 21, 2021 Hi Jos, Thank you for the advise. I will try and check but seems like it is a very good approach Thank you. Link to comment Share on other sites More sharing options...
pseakins Posted May 22, 2021 Share Posted May 22, 2021 13 hours ago, TheOne23 said: "This is a testing!" Teaching your computer how to talk in "EU Speak". Phil Seakins Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now