earnest ma's site

Mic Push-to-talk With AutoHotkey and SoundVolumeView

This is an AutoHotkey script I set up to use with NirSoft’s SoundVolumeView.

It uses the command-line from that to send mute/ unmute the microphone (through the system) whenever a key is held down. It’s not perfect and there is a small delay, so improvements are definitely welcome. Anyways, here it is:

#SingleInstance, force
#NoEnv
SendMode Input
#persistent

{
    ToolTip, Starting now...
    RunWait, PowerShell "SoundVolumeView.exe /Mute 'Realtek(R) Audio\Device\Microphone\Capture'",, hide
    SoundBeep, 200, 1000
    launched := false
    ToolTip, You should be muted
    Sleep, 1000
    ToolTip
    return
}

`::
{
    if(not launched) {
        RunWait, PowerShell "SoundVolumeView.exe /Unmute 'Realtek(R) Audio\Device\Microphone\Capture'",, hide
        SoundBeep, 442
        ToolTip, YOU ARE UNMUTED
        launched := true
    }
    return
}

` Up::
{
    RunWait, PowerShell "SoundVolumeView.exe /Mute 'Realtek(R) Audio\Device\Microphone\Capture'",, hide
    SoundBeep, 200
    launched := false
    ToolTip
    return
}


F1::
{
    RunWait, PowerShell "SoundVolumeView.exe /Unmute 'Realtek(R) Audio\Device\Microphone\Capture'",, hide
    SoundBeep, 442, 1000
    ToolTip, Unmuting and exiting
    Sleep, 1000
    Tooltip
    ExitApp
}

Tags: #autohotkey #scripting

Comments

You may view or reply if you have an account anywhere in the Fediverse.

Recent posts from blogs I read Generated by openring

Weekly review: Week ending February 19, 2021

I got captions to flow from my phone to Node to Emacs to OBS to Twitch. There’s some delay, but it’s a good starting point that might come in handy for live captioning my own stuff. I added autocategorization to Emacs News. I tried out pretty-hydra. I wro…

via sacha chua :: living an awesome life February 21, 2021

A great alternative is rarely fatter than what it aims to replace

This is not always true, but in my experience, it tends to hold up. We often build or evaluate tools which aim to replace something kludgy^Wvenerable. Common examples include shells, programming languages, system utilities, and so on. Rust, Zig, etc, are tak…

via Drew DeVault's blog February 21, 2021

Back Home

I was busy sanding down the planks all evening last Sunday in that unbearable cold in the garage and just nearly got done when it started snowing. My wife had been lamenting all week about the snow in Dallas and naturally this made her happy. That happine…

via simbly.me February 20, 2021