Author Topic: Voice activation for in-game keypress for voice comms  (Read 2055 times)

yoppity

  • Newbie
  • *
  • Posts: 3
Voice activation for in-game keypress for voice comms
« on: April 23, 2020, 12:50:20 AM »
First off, I've only just installed VA and I was sure it would be easy to use it with CSGO.

Background: I'm too uncoordinated to press and hold an additional key in-game to talk to my team mates
I have been using AutoTalk to do this for me but find the sensitivity of the mic a little too sensitive (picks up breathing sometimes, no matter where I put my mic)

Aim:
- Use VA to activate my in-game button (press and hold "k" while I am talking), unpress when there is 1.5s of silence
- Be able to adjust what silence is (dB or whatever), ie. input volume thresholds

Can someone talk me through how to do this? Any help would be greatly appreciated!!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Voice activation for in-game keypress for voice comms
« Reply #1 on: April 23, 2020, 10:42:44 AM »
VoiceAttack is designed for speech recognition, I.E. executing commands when certain phrases are recognized; What you are describing is more suited to a tool designed specifically for that purpose.


There is no method for getting the volume of an input device.

The "{STATE_SPEECHACTIVE}" token can be used to determine whether the speech recognition engine is hearing something, but that includes environmental noise, and cannot be adjusted for volume independent of your microphone volume.


Even if you could get the input volume of your microphone, if it's picking up environmental noise you may not be able to find a threshold that reliably only triggers when you speak, and doesn't drop out while you're speaking.

yoppity

  • Newbie
  • *
  • Posts: 3
Re: Voice activation for in-game keypress for voice comms
« Reply #2 on: April 23, 2020, 06:00:35 PM »
Thanks Pfeil!
can VA be used to complete the first aim though?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Voice activation for in-game keypress for voice comms
« Reply #3 on: April 23, 2020, 06:09:16 PM »
Yes. However, "silence" will be relative to what the speech recognition hears. Especially if you have a microphone that picks up a lot of environmental noise (including, for example, the pressing of keyboard keys), it may not detect silence often enough for the command to work reliably.


If you really want to try such a command, look into the "Start an Indefinite Loop" action to have the command running in the background, and the "Set a Date/Time Value" action combined with the "Date/Time" tab of the "Begin a Conditional (If Statement) Block" action for the timeout.


This command is intended to allow dictation until the speech recognition engine detects silence, but as it shows most of the principles you're likely to need, it can serve as an example:
Code: [Select]
Start Dictation Mode (Clearing Dictation Buffer)
Set date [~speechTimeout] to [~speechTimeout] plus [5] seconds
Start Indefinite Loop
    Begin Text Compare : [{STATE_SPEECHACTIVE}] Equals '0'
        Begin Date Compare : [~speechTimeout] Is Before Current Date/Time
            Stop Dictation Mode
            Write [Blue] '{DICTATION}' to log
        End Condition - Exit when condition met
    Else
        Set date [~speechTimeout] value to the current date/time
        Set date [~speechTimeout] to [~speechTimeout] plus [3] seconds
    End Condition
End Loop

yoppity

  • Newbie
  • *
  • Posts: 3
Re: Voice activation for in-game keypress for voice comms
« Reply #4 on: April 23, 2020, 06:14:48 PM »
Thanks so much! I'll give it a whirl and see how I go!