Author Topic: Mute music when activating VA listening?  (Read 1190 times)

Bazmack

  • Newbie
  • *
  • Posts: 21
Mute music when activating VA listening?
« on: July 27, 2022, 01:30:51 AM »
Is it possible for voice attack to steal audio focus (temporarily mute) when saying commands when music is playing?
I press my hot key so that voiceattack starts listening but it can't hear me if music is playing is there a way for it to pause the music when the hot key for listening is pressed? Could this be done by temporarily muting the music for two seconds similar to how windows does when pressing WIN + H when native voice typing?
(II use the right mouse button as a hotkey to start VA recognition)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4800
  • RTFM
Re: Mute music when activating VA listening?
« Reply #1 on: July 27, 2022, 01:34:44 PM »
You could use a command, in addition to the "Recognition Global Hotkey" option (triggered using the same shortcut).

That command could then contain either a "Set Audio Level" action to mute the relevant playback device, a two-second pause action, then another "Set Audio Level" action to unmute again, or, if your music application responds to a given keyboard shortcut to suspend playback, a keypress action that presses and releases the keys for that, the pause, then another keypress action to resume playback.

The former mutes everything (playing through the given device, at least), but will always mute everything, while the latter would only pause the music, but if it was already paused would instead start playback unintentionally.

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Mute music when activating VA listening?
« Reply #2 on: July 27, 2022, 11:14:26 PM »
Unfortunately having a second commend run stops the R click hot key from then working. And also (strangely ii have no Windows right click menu - which Iiii don't want to give up)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4800
  • RTFM
Re: Mute music when activating VA listening?
« Reply #3 on: July 28, 2022, 02:09:40 AM »
Did you enable (or leave enabled) the "Do not allow button event to be passed through" option for the "When I press mouse" option of the command?

If you want to keep the normal functionality of the button (and, because of how the Windows mouse API works, allow other features to use that button), disable (uncheck) that option.

DreamWeaver

  • Newbie
  • *
  • Posts: 4
  • Everything is funny. Everything is stupid.
Re: Mute music when activating VA listening?
« Reply #4 on: December 09, 2024, 10:43:11 AM »
You might consider running PowerToys as it allows you to use set multimedia buttons using shortcuts from Keyboard Manager.  You can remap multimedia buttons like volume up and down to other keys if you don't have a keyboard with multimedia functions on it.  I have CTRL+PgUp mapped to volume up, CTRL+PgDn to volume down, and CTRL+Home to toggle Mute.
I haven't tried the latest Video Conference Mute in PowerToys as it allows users to map keys to quickly mute the mic and / or camera.

iceblast

  • Sr. Member
  • ****
  • Posts: 375
Re: Mute music when activating VA listening?
« Reply #5 on: December 19, 2024, 11:47:04 PM »
Just use this. When you hold the mic key for VA, it will drop all audio to 1, and save what the audio was, and when you release, return the audio back to what you had it set to before. This way, when every you key up to use VA, it will be silent in your room, but also return it back to your previous audio setting.

Code: [Select]
Set integer [Volume] value to the converted value of {STATE_SYSVOL}
Start Loop While :  Keyboard Key 'F22' Is Pressed
    Set default playback device volume to [1]
End Loop
Set default playback device volume to [{INT:Volume}]

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4800
  • RTFM
Re: Mute music when activating VA listening?
« Reply #6 on: December 20, 2024, 12:59:17 AM »
You'd want to structure it like this instead, so it's not continuously lowering the volume while the key is down:

Code: [Select]
Set integer [Volume] value to the converted value of {STATE_SYSVOL}
Set default playback device volume to [1]
Start Loop While :  Keyboard Key 'F22' Is Pressed
End Loop
Set default playback device volume to [{INT:Volume}]

And, instead of worrying about volume, you could just mute the device:
Code: [Select]
Mute default playback device
Start Loop While :  Keyboard Key 'F22' Is Pressed
End Loop
Unmute default playback device