Coder Social home page Coder Social logo

saifaqqad / ahk_micmute Goto Github PK

View Code? Open in Web Editor NEW
164.0 5.0 13.0 9.04 MB

Control your microphone using keyboard and mouse hotkeys.

License: The Unlicense

AutoHotkey 60.86% HTML 31.20% CSS 7.89% SCSS 0.06%
autohotkey ahk microphone micmute push-to-talk mute-unmute hotkey

ahk_micmute's Introduction

MicMute

Control your microphone using keyboard and mouse hotkeys.

Features

  • Set up multiple profiles and link them to apps/games
  • Control multiple microphones simultaneously
  • Use separate hotkeys for Mute/Unmute or a single toggle/push-to-talk/push-to-mute hotkey
  • AFK timeout - Automatically mutes the microphone when you're AFK
  • Customizable sound and on-screen feedback
  • Always-on-top overlay to show the microphone's state
  • Run custom scripts/programs when muting/unmuting the microphone
  • ASUS Aura Sync integration
  • Voicemeeter integration

Installation

A. Install using Scoop

# Add the extras bucket
scoop bucket add extras

# Install MicMute
scoop install micmute

You can update MicMute using scoop update micmute, your config file will be saved between updates.

B. Use standalone executable

You can download MicMute and use it standalone.

Note: The config file will be saved in the same directory as the executable.

Usage

The first time you launch MicMute, a configuration window will open
The first time you launch MicMute, a configuration window will open

  1. Select your microphone from the list.
  2. Choose the hotkey type (Toggle, Push-to-talk or seperate hotkeys).
  3. Select the hotkey options you want. see hotkey options.
  4. Click Record and press the key(s) combination for the hotkey, then click on Stop to save it.
  5. Go to the Feedback tab and select the feedback options you want. see feedback options.
  6. If you're setting up multiple profiles, you can link a profile to an app/game. see linked applications.
  7. If you want the microphone to be auto muted when you idle, setup AFK timeout.
  8. If you're setting up a PTT hotkey, you can change the delay between releasing the key and the audio cutting off by changing the PTT delay option.
  9. Click on the save button.

Notes

  • You can change a profile's name by right clicking it.

    GIF

    OSD

  • When you set up a hotkey for a microphone, a * will appear before the microphone's name


Hotkey options

Option Description
Passthrough Hotkey presses will passthrough to the system (They won't be exclusive to MicMute).
Wildcard Trigger the hotkey even if it's pressed with extra modifiers/keys.
Neutral modifiers MicMute won't differentiate between Left and Right modifiers (i.e Left/Right shift will both be Shift). This option should be set before recording the hotkey.
Hybrid PTT Turns a PTT hotkey into a Hybrid PTT/Toggle hotkey (Long press -> PTT, short press -> toggle).

Feedback options

1. Sound feedback

Play a sound when muting/unmuting the microphones.

  • You can select which output device to play the sound on.

  • You can use custom sounds:

    1. Turn on the option in the config UI
    2. Make sure the sound files (mp3,wav) are in the same folder as MicMute.exe
    3. Rename them as:
      • Mute sound: mute

      • Unmute sound: unmute

      • PTT on: ptt_on

      • PTT off: ptt_off

2. On-screen feedback

Show an OSD when muting/unmuting the microphones.

  • GIF

    OSD

  • You can change the OSD position (default position is the bottom center of the screen, above the taskbar).

  • You can exclude fullscreen apps/games from the OSD, this is needed for some games that lose focus when the OSD is shown.

3. On-screen overlay

Show the microphone's state in an always-on-top overlay.

  • GIF

    overlay

  • CTRL ALT F9 toggles show/hide

  • CTRL ALT F10 toggles locked/unlocked

  • You can drag the overlay to change its position when it's unlocked

  • Games need to be set to Windowed fullscreen or Borderless for the overlay to show up on top

  • You can set the overlay to only show if the microphone is muted or unmuted

  • You can set the overlay's size and theme (light/dark)

  • You can use custom icons for the overlay. To use this feature, turn on the option in the config UI, then place the icons (ico/png/jpeg) in the same folder as MicMute.exe and rename them as:

    • Mute icon: overlay_mute
    • Unmute icon: overlay_unmute

Linked applications

Link a profile to an app/game, when the app becomes visible (not minimized or hidden), MicMute will automatically switch to that profile, when the app is minimized/hidden/closed, MicMute will switch back to the default profile.

Foreground only option (Enabled by default) can be disabled so background apps (minimized or hidden) can also trigger the profile switch. v1.2.8+

Volume Lock

Locks the microphone's volume to a specific value and prevents other apps from changing it. v1.2.8+

Microphone actions

Run programs and powershell scripts when muting/unmuting the microphone(s).

Screenshot

Microphone actions

1. Program action:

Run any program (with optional arguments) when muting/unmuting the microphone(s).

You can also use the following variables in the arguments, which will be replaced with the actual values for the microphone:

Variable Description
${microphone.name} The microphone's name (example: Headset Microphone).
When using All Microphones, this will only contain the word Microphones
${microphone.fullName} The microphone's full name, including the controller's name (example: Headset Microphone (Razer Barracuda X)).
When using All Microphones, this will contain the full name of every microphone seperated by ,
${microphone.state} The current state of the microphone (Muted or Online)
${microphone.isMuted} Whether the microphone is muted or not (true or false)
${microphone.hotkeyTriggered} Whether the hotkey was triggered or not (true or false).
if this is false, the microphone was muted/umuted externally (by windows or another app)

2. Powershell action:

Run a powershell script when muting/unmuting the microphone(s), This can be used for anything, for example, you could send an http request to turn on/off a connected light with Home Assistant or send a notification to your phone with ntfy.

You can use the same variables as the program action (and you can insert the 'Microphone Data' snippet in the editor to use them).

  • Screenshot

    Powershell action editor

  • HTTP request example

    This example sends a notification using ntfy.

    $microphone = @{
       name = '${microphone.name}';
       state = '${microphone.state}';
    };
    
    $ntfyUrl = "https://ntfy.sh";
    $ntfyBody = @{
      topic = 'your topic here';
      message = "$($microphone.name) $($microphone.state)";
      title = 'MicMute Alert';
      priority = 4;
    } | ConvertTo-Json;
    
    Invoke-RestMethod -Method Post -Uri $ntfyUrl -Body $ntfyBody -ContentType 'application/json';

This action works by encoding the script using base64 (UTF-16LE) and then passing it to powershell using the -EncodedCommand parameter, this avoids the need to create a temp file to run the script and even avoids any issues related to escaping special characters.

3. Aura Sync action: v1.2.8+

Syncs the microphone's state with ASUS Aura Sync compatible devices.

  • You need to have Armoury Crate (or the standalone Aura Sync app) installed for this action to work, though it doesn't need to be running.

  • Screenshot

    Aura Sync action

Due to how slow the Aura Sync API is, this action requires a seperate MicMute process that controls the RGB by listening for messages from the main MicMute process, this ensures that the action does not affect the responsiveness of the hotkeys.


Global options

These options are shared between all profiles.

1. Mute on startup

Mute the microphone(s) when starting up or switching profiles.

2. Switching-profile OSD

Show an OSD with the profile's name when switching to it.

3. UI Theme

UI Theme can be set to System Theme, Dark or Light

This does not affect the tray icon color, which is always based on the system theme

4. Force microphone state

Prevent other apps from changing the microphone's state (i.e mute/unmute the microphone).

Note: This might break the unmute functionality in some apps, if this happens you'll need to unmute the microphone using MicMute before unmuting inside the app)

5. Voicemeeter integration

You can control Voicemeeter's inputs and outputs using MicMute, after turning on the option, refresh the microphones list and you should see voicemeeter's inputs (strips) and outputs (buses) in the microphone dropdown.

  • Screenshot

    Image

By default, MicMute will use the bus/strip's mute property, in the case of a strip, it can be set to any other property (A1, A3, B3, etc..) by changing the VMRStripProperty value in the config file.


Controlling multiple microphones

You can have multiple active hotkeys to control different microphones simultaneously. To do this, turn on the Multiple option then select another microphone from the list and setup hotkeys for it.

When using this feature, the following applies:

  • The tray icon will be the static MicMute icon
  • The tray icon will no longer act as a toggle button, and the tray menu option to toggle the microphone will be disabled
  • The On-screen feedback OSD will show the microphone name when muting/unmuting
  • The On-screen overlay is disabled

Alternatively, you can control all the microphones at once with the same hotkey by selecting All Microphones from the microphones list.

When using this feature, the following applies:


Known issues

  • Valorant might detect MicMute as a cheat #59

  • When running AutoHotkey alongside Microsoft Powertoys, they might conflict with each other, which may result in the hotkeys not working at all. microsoft/PowerToys#2132

  • Albion Online detects MicMute as a botting tool, the games blacklists anything written in autohotkey and marks it as a botting tool. #23

  • Windows defender might falsely detect MicMute as a trojen/malware (Zpevdo.B or Wacatac.B!ml). I always submit new releases to microsoft to remove the false detections and they usually do in a couple of days, but sometimes when they release a new definition update the detection occurs again. #25

Editing the config file

Hold Shift when clicking Edit configuration in the tray menu, and the config file will open in the default JSON editor

Accessing the logs

Hold Shift when clicking Help in the tray menu, and the logs window will open.

CLI arguments

Argument Description
/profile=<profile name> Startup with a specific profile.
/noUI Disable the configuration UI completely. This decreases memory usage by almost 60%.
/debug Add shortcuts to ListVars, ListHotkeys and View Log in the tray menu. Enables logging for Aura Sync action (v1.2.8+)
/logFile=<file_to_log_to> Outputs the log to a file (it's written to stdout by default )

Example: MicMute.exe "/profile=profile 1" /noUI /debug /logFile=MicMute.log

Compile instructions

Note: Run the following commands in powershell, not command prompt.

1. Install prerequisites

You'll need AutoHotkey (Ahk2Exe), git and ahkpm in your path.

You can install them using scoop:

  1. Install scoop
    # This allows running powershell scripts.
    Set-ExecutionPolicy RemoteSigned -scope CurrentUser;
    
    # This runs the scoop installer script.
    irm get.scoop.sh | iex
  2. Install prerequisites
    scoop install git;
    scoop bucket add extras;
    scoop install autohotkey ahkpm;

2. Clone the repository

git clone https://github.com/SaifAqqad/AHK_MicMute.git;
cd .\AHK_MicMute\;

3. Install the dependencies

ahkpm install;

4. Download and extract BASS library

Invoke-WebRequest "www.un4seen.com/files/bass24.zip" -OutFile ".\bass24.zip";
Expand-Archive ".\bass24.zip" -DestinationPath ".\base24\";
Copy-Item ".\base24\x64\bass.dll" -Destination ".\src\Lib\bass.dll";

5. Run the compiler

ahk2exe.exe /in ".\src\MicMute.ahk" /out ".\src\MicMute.exe";

Libraries and resources used

Library License
Material Design icons Apache 2.0
BASS audio library License
VA.ahk License
VMR.ahk License
mmikeww/AHKv2-Gdip License
Bulma CSS framework MIT
CodeMirror 5 MIT
G33kDude/cJson.ahk MIT
G33kDude/Neutron.ahk MIT
jscolor Color Picker GPL v3

Credits

This project would not exist without these people:

ahk_micmute's People

Contributors

imgbot[bot] avatar imgbotapp avatar reenuip avatar saifaqqad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ahk_micmute's Issues

Does not detect new devices until reloading

When i connect my bluetooth headset or any other mic i have to reload it for it to recognise i added a new device and mute it as well (I use mute All microphone). maybe auto reloading when a device disconnects or connects?

micmute crashes after sleep

Using windows 10 after I wake the PC from sleep I consistently have to start micmute manually as the icon in the taskbar disappears as soon as I hover on it, I think it somehow does not survive the PC going to sleep.
Shortcuts are also non responsive and nothing micmute related is showing on the task explorer.
Don't know where to find logs so not sure if it's a crash or windows simply not waking it up...

Only wanted to add, I love the software anyway ! lightweight and very usefull to me, very polished and overall great experience ! Thanks a lot !

[Feature Request] Ability to change on/off sounds in the config file.

And thanks for making this software - MS teams doesn't have push to talk.

It would also be nice to have documentation on building the application so we can change it ourselves. To other people, on windows go to:
C:\Program Files\AutoHotkey\Compiler
Then run:
.\Ahk2Exe.exe /in [path to the git repo]MicMute.ahk

A .exe will be generated at the git repo path.

Hotkey stops working in GTA 5

I don't know if the issue exists in other games too but when I launch GTA 5 (not administrator), my MicMute push to talk hotkey stops working. MicMute is running as administrator.

[Request] Support for disconnected devices

I am on a laptop and use different microphones depending on where I am. I was wondering if it was possible for MicMute to list devices as [DISCONNECTED] for example and ignore them on startup instead of stopping MicMute from opening and showing an invalid configuration message.

[Feature Request] Voicemeeter Integration

Basically a feature that allows to pick a Voicemeeter Hardware Input 1,2,3,4,5 B1,2,3 bus for push to talk. I could do this with Voicemeeter's included MACRO Buttons but the hotkeys on there have many issues such as not working in some fullscreen games.

[Feature] Add microphone actions

for example, running a command/program when muting/unmuting a specific microphone.

Might consider abstracting the existing feedback options (sound/on-screen feedback) as additional microphone actions.

[Request] Сustom microphone icon

I wanted to be able to change the microphone icon to my own in the overlay. Similar to how it is done with sounds.
You can also add settings for the position of the icon on the screen.

[Request] Sound that loops while push to talk or toggle talk is on.

Currently, there are options in MicMute to add custom sounds for muting and unmuting the microphone.

I think adding an option for a custom sound that loops for the duration that the microphone is unmuted would be a fun feature.

Not really necessary and important, just a fun feature I thought of.

[Feature] Add push-to-mute

Hello, please add push-to-mute option. Assigning separate hotkeys for push-to-mute and toggle options.

default profile also mute my speakers

Hello,

Somehow when using my Jabra phs200, the default profile mutes not only it's microphone but also the speaker.
I've tested with the default profile set to mute "default", or the "jabra mic..." or "all microphones" and it still heppens.
The strange thing is that if I create a "Profile 2" with the same settings it works fine and only the mic gets muted and not the speaker.
Looking at the settings.json, both default and profile2 entries are exactly identical except profile name...

No idea what is special about the Default profile that fails. That did not happen with another PC and another soundard... But works fine with my other all-in-one usb jabra headser for example.

Not sure how to give some more logs or details, I'm not sure how I can help further...

switching between profiles

Hey! Great App!
I have one issue with it though. I use two profiles. (gist with config) One for ms teams which I use exclusively for University and always want to use push to talk with, and one for private use in discord, in which I always wnat to have an open mic (or toggle).

Now my issue is that the program only switches profile when I close the app i.e. end the task and then open the other app. Not when it's minimized. This is an issue for me since I want both always running in the background. Would it be possible to change when the target window becomes active, instead of when it starts?

Alternatively I would be fine with the possibility to set a hotkey to switch profiles.

Do you think you could implement either of these features?

Thanks for your work and I hope you can help me :)

[bug] losing mouse input whenever mic is unmuted

These are my settings:

https://i.imgur.com/u3KhObg.jpeg
https://i.imgur.com/BZ8AMxU.jpeg
https://i.imgur.com/v8XOTd0.jpeg
https://i.imgur.com/2bmEW4g.jpeg

When I want to unmute my mic, I press the side mouse button and it unmutes but I lose all inputs from my mouse; I can't click on anything anymore. Workaround for the moment is to block my Windows session (WIN + L) and get back.

If I can help providing logs or whatever you need, please let me know.
Thanks

[Request] Onscreen overlay "On-active only" option + semi-transparent background

Discussed in #35

Originally posted by gitmaker032 September 9, 2021
Hello! Thanks for the great app.

But I really miss the "On-active only" (Onscreen overlay) option. For me it is more important to know when the microphone is active. A kind of explicit reminder that the microphone is active and should not forget to turn it off.

I think it would also be nice to add a semi-transparent black background for the icon, because it can blend in with the white objects on the screen now.

image

MicMute show error "-4" if no microphone is plugged in

The program show "-4" in a dialog window if no microphone is plugged in. I am guessing maybe "Mute on startup" is required as well to recreate this.

Happens in version 1.2.3. Pretty sure it happens in 1.2.2 as well.

error-4-dialog
error-4-log

Mic is unmuted even though "Mute on startup" is enabled

I updated MicMute yesterday (not sure which version I came from - but it was most likely months old) to 1.2.2 and now the mic is enabled after a reboot even though I have enabled "Mute on startup". At first I thought this might be because in the new version the app now start on startup using Task Scheduler, but I have tested by going back to having a shortcut in shell:startup without seeing any difference. I have also disabled and re-enabled "Mute on startup" to see if there was some kind of syncronization issue with the settings. This did not help either.

[Enhancement] Assign profile options per controller

For example, if the overlay was bound to a microphone instead of the profile, it would allow for multiple microphones to have overlays on the screen

Although I would need to restructure the config object and the config UI, so more options would be set per controller

FeatureRequest: Mute All or several with single hotkey

Hello,
It seems that if I setup the same hotkey to toggle multiple microphones it refuses to work claiming conflicting hotkeys.
I think it makes sense to be able to mute several microphones with the same hotkey, possibly even have a "virtual microphone" named "all inputs" that would automatically apply the action mute/unmute to all microphones and for which I setup a single hotkey and I do it only once instead of going into each microphone to record the same hotkey each time.

[Bug] Overlay multi monitor issue

Currently, when using multiple monitors, the overlay stores its position relative to the leftmost monitor's top left corner
which is not ideal because disconnecting one of the monitors may result in the overlay disappearing as it's placed out of the monitor's bounds.

[Request] Frequently check if Mic is still muted in Windows

Some programs like to mess with recording devices for some reason. (For me it is Black Ops 2) If it only unmuted the default recording device it would make more sense. I don't have both my mics selected as default or default communication devices and it still tries to unmute everything. For BO2, it unmutes when the game first starts up and then whenever you mess with the voice chat settings it also unmutes again.

I think that if MicMute checked whether the mics selected in the UI were actually still muted within windows when they're supposed to it will help with this issue.

1.2.5 update problems

update through micmute's updater mode triggers checksum mismatch. Was able to manually download the exe through discord but stumbled upon various obstacle from downloading it kept being flagged as an infected file with "Gen:Variant.Tedy.226738" to running it with windows flagging it unsafe to run.

image

I have checked the SHA256 checksum and it matches so I went ahead with the download and the running of the app, but I have never had any problem with the previous version so I was wondering what's up with these.

image

And also, my firewall auto blocked the connection to " 20.205.243.168/0" from this app a few moments after I ran it so I was also wondering what the connection is for should I just leave it to be blocked.

image

Addition to voicemeeter integration

Per strip selection.

In Voicemeeter's MacroButtons you can modify options per strip.

For example:

strip[0].B1 = 0;

This will disable B1 in strip 0.

image

Possibly detected as a cheat in Valorant

I was recently banned from Valorant for "Using unauthorized third-party software" even though I'm not cheating.

I had recently reset and fresh-installed windows on my PC, so it did not have a lot of software installed which lead me to believe it was detecting MicMute as a cheat (possibly because of the overlay), however, I'm not 100% sure.

I contacted Riot's support and they weren't all that helpful, they just confirmed that it was a permanent ban on my account and a temporary ban on my PC (hwid) for 120 days, they did not however, reveal anything about the actual cause of the ban.

Screenshot 2022-03-31 234903

I contacted them again, this time I explained the situation with MicMute and what it does and told them what I had suspected and they still were not helpful and did not care at all.

Screenshot 2022-03-31 235401

I can't do anything about this except adding this issue as a warning for other people.

MicMute not stating on boot

Hi,
Each time I boot I do not see the program running when booting even if I selected it to do so.

imagen

I have to manually click on the icon in order to start it.
Not a huge problem, but it's annoying xD

Not sure if it's a bug or if I have to do something else.
Hope you can tell me anything about it.
Thanks

BTW, great program ;)

Notification of administrator privileges

Sometimes I get this notification when the app is running. At the same time there are no problems with hotkeys and other functionality, everything works fine. I don't quite understand why this notification appears.

librewolf_NIQi7G1vDJ

MicMute crashes if in update mode and it is blocked by firewall

I use a firewall software called simplewall which block any process from outward communication unless I explicitly allow it. It seems MicMute crashes if it's trying to update itself and MicMuteUpdater.exe is blocked from outside communication.

---------------------------
MicMuteUpdater.exe
---------------------------
Error:  0x80072EFD - 
Source:		WinHttp.WinHttpRequest
Description:	A connection with the server could not be established


HelpFile:		(null)
HelpContext:	0

Specifically: WaitForResponse

	Line#
--->	2173: http.WaitForResponse()  

The current thread will exit.

Autostart: how does it work?

I cannot find MicMute in any place for it to autostart - registry, shell:startup, scheduled tasks..
I also unticked the option for start at boot but every time I exit the app and run it again, the flag is set again.

Can you help?

Hotkey to toggle monitoring

There is option in windows mic settings - "Listen to this device". It would be awesome if we can quickly toggle it by hotkey - to be sure that our sound is clear and loud enough at any time of conversation.

[Feature] Always display OSD

I would like to be able to see the OSD at all times to check if my mic is muted or not. I understand I could use the system tray icon but I can't see that when im in a fullscreen game. I like to keep the OSD on my 2nd monitor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.