Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicLock — pin your microphone volume on Windows

CI License: MIT

Lock your microphone input level and snap it back the instant anything moves it — from a system tray icon.

Discord, Zoom, Teams, OBS, browsers, and Windows' own automatic gain control constantly change your mic capture level behind your back. You set it to 75%, join a call, and it's at 100% (or 30%) again. MicLock watches the default microphone and, while the lock is on, re-asserts your chosen level the moment it drifts.

  • Works on Windows 10 and 11, on the default capture device
  • Tray icon shows the state — green = locked, gray = unlocked
  • Instant correction via the audio engine's own change notifications (not polling) — the level is restored in milliseconds
  • Pick a target level (100 / 90 / 75 / 50%, or "use current level")
  • Start with Windows and per-user settings, no admin required
  • Tiny (~165 KB), no runtime, fully offline (no network, no data)

Usage

Launch the app; it sits in the notification area (on Windows 11 look under the overflow flyout and drag it onto the taskbar to pin it):

  • Left-click the icon — toggle the lock on/off
  • Right-click — menu:
    • Lock microphone volume (checkbox)
    • Target level → 100 / 90 / 75 / 50%, or Use current level
    • Start with Windows
    • Exit

When you first enable the lock without having picked a level, MicLock adopts whatever the mic is currently set to as the target.

Scripting helpers

Two hidden flags are handy for scripts and testing (they exit immediately, reporting via the process exit code):

miclock --get        exit code = current mic level percent (0..=100), 255 on error
miclock --set <pct>  set the mic level to <pct> percent

How it works

MicLock resolves the default capture endpoint via the MMDevice COM API and gets its IAudioEndpointVolume. It registers an IAudioEndpointVolumeCallback, so the audio engine notifies it of every level change — no polling. A dedicated audio thread then re-applies your target with SetMasterVolumeLevelScalar whenever the level drifts while locked.

Its own corrections are stamped with a private event-context GUID; the callback ignores notifications carrying that GUID, so re-asserting the level never triggers itself — no feedback loop. If the default device changes or disconnects, MicLock re-resolves it automatically. Your target level and lock state persist per-user under HKCU\Software\miclock.

Build

Rust with the MSVC toolchain:

rustup default stable-x86_64-pc-windows-msvc
cargo build --release

The exe lands in target\release\miclock.exe.

Smart App Control: if SAC is enabled, Windows blocks locally-built unsigned executables, so building and running this tool require SAC to be off.

License

MIT — see LICENSE.

About

Pin your Windows microphone volume — snap it back when Discord, Zoom, or AGC change it

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages