Push to talk - I am doing something wrong

Has anyone implemented a push to talk function for Teams or the like

on push toggles mute, and on release toggles again.

I have tried

pressKey LSCAG-M
ifNotReleased {
    delayUntil 100
    goTo ($currentAddress-2)
}
pressKey LSCAG-M

and

pressKey LSCAG-M
delayUntilRelease
pressKey LSCAG-M

But I only seem to get the first even triggered. What am I messing up?

If I simpliy to

pressKey M
delayUntilRelease
pressKey M

I would expect to see an β€œM” printed on keypress and then another one on key release. But I only see one β€œM”.

I’m not an expert and just started playing around with macros, but my understanding is that you need to use the releaseKey in your macro to complete the first activation and deactivation of the scan code and the second pressKey will activate it again. Otherwise you are activating an already activated scan code.

This macro works as you described, triggering a β€˜M’ when holding and another when releasing:

pressKey M
delayUntilRelease
releaseKey M
press Key M
1 Like

See my config for mute/unmute and push-to-talk in my maxtend github repository.

mute-unmute:

ifSecondary final suppressMods holdKey LC-space
suppressMods tapKey LCLS-m
ifNotShift break
delayUntil 600
suppressMods tapKey LCLS-semicolonAndColon // CS-o on Colemak host

Also be aware that I have configured my secondary settings for advanced strategy and a timeout. The above macro uses this to trigger push-to-talk when you press and hold the button for longer than the advanced.timeout.

In $onInit:

...
set secondaryRole.defaultStrategy advanced
set secondaryRole.advanced.timeout 250
set secondaryRole.advanced.timeoutAction secondary
set secondaryRole.advanced.triggerByRelease 1
...
1 Like

Oh, and BTW, LC-space is the built-in push-to-talk functionality in Teams. You don’t need to press LCLS-m twice. Just hold LC-space while you speak. My macro just maps everything onto one single key:

  • hold for push-to-talk
  • tap to mute or unmute
  • shift-tap to mute/unmute AND turn the camera on/off

I believe you want this:

tapKey LSCAG-m
delayUntilRelease
tapKey LSCAG-m
3 Likes

Thanks all. Working a charm now.