Jump to content

How to Mute only AutoIT scripts that are using Text to Speech


Recommended Posts

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

  • Developers

Doesn't SAPI.SpVoice have an option for that?
Something like "$oSP.volume = 0 ; mute" ? 

Edited by Jos

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

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.

Global $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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...