Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LevelMate

LevelMate is a Windows command-line utility that keeps one application's audio at a more consistent level. It monitors a process tree through WASAPI, reduces loud passages, and can optionally boost quiet content. Audio is processed locally in memory-no audio is recorded, transmitted, or saved.

Features

  • Real-time automatic gain control targeting -16 dBFS
  • Application-level targeting that leaves unrelated audio unchanged
  • Optional digital boost for content that is still quiet at 100% app volume
  • Simple bass, mid, and treble adjustment for harsh or boomy sources
  • Live terminal meters and detached background operation
  • Automatic volume restoration after normal or interrupted runs

Requirements

  • Windows 10 build 20348 or later, x64
  • Visual Studio 2022 Build Tools with Desktop development with C++
  • A Windows SDK containing audioclientactivationparams.h
  • CMake 3.25 or later

Administrator privileges are not required.

Quick start

Open PowerShell in the repository, then build and test the Release executable:

.\run.ps1 --build
.\run.ps1 --test

Start audio in the application you want to target, find its root process ID (PID), and run:

.\build\Release\levelmate-wasapi-probe.exe <root-pid>

Press Ctrl+C to stop and restore the application's original volume.

For Firefox, the helper can locate its root PID and start LevelMate in digital boost background mode:

.\run.ps1 --firefox

Usage

levelmate-wasapi-probe.exe <root-pid> [--duration <seconds>] [--rerender] [--bass <dB>] [--mid <dB>] [--treble <dB>] [--background]
levelmate-wasapi-probe.exe --shutdown
Option Description
--rerender Enables digital boost: captures, processes, and rerenders the target audio to the default output device.
--bass <dB> Adjusts frequencies below roughly 200 Hz from -12 to +12 dB.
--mid <dB> Adjusts frequencies around 1 kHz from -12 to +12 dB.
--treble <dB> Adjusts frequencies above roughly 4 kHz from -12 to +12 dB.
--duration <seconds> Stops after a positive whole number of seconds.
--background Runs detached from the current terminal.
--shutdown Stops the active foreground or background instance and restores its target's volume.

Standard mode adjusts the application's session volume. It can reduce loud audio but cannot amplify beyond 100%. Digital boost mode can add up to 20 dB and limits processed peaks to the -16 dBFS target. Both modes use a 50 ms attack, 3000 ms release, and a -60 dBFS silence gate.

EQ options automatically enable digital rerender mode. For a boomy or voice-heavy YouTube video, a useful starting point is:

.\build\Release\levelmate-wasapi-probe.exe <browser-root-pid> --bass -6 --mid -3

Negative values reduce a band and positive values boost it. The AGC and peak limiter run after EQ, so boosted bands remain subject to the normal output ceiling.

Run only one LevelMate instance at a time.

Choosing a target

LevelMate groups the root PID and its descendants into one audio source. Start playback before launching LevelMate because it discovers active streams only at startup. If the application creates a stream later, restart LevelMate.

List processes in PowerShell:

Get-CimInstance Win32_Process |
  Sort-Object CreationDate |
  Format-Table Name, ProcessId, ParentProcessId, CreationDate -AutoSize

For browsers and other multi-process applications, select the oldest long-lived process whose parent is not another process from the same application. For games and media players, the main executable is usually the correct target.

Only the selected process tree is normalized; all other applications continue through their normal audio paths. Multiple streams within the selected tree are processed as one combined source.

Safety and limitations

  • Begin at a comfortable output volume; digital boost can add up to 20 dB.
  • Stop with Ctrl+C, --shutdown, or --duration so LevelMate can restore the original application volume.
  • Before changing volume, LevelMate writes a small recovery record to %LOCALAPPDATA%\LevelMate\volume-recovery.bin. The record contains session identifiers and volume values, not audio. LevelMate removes its entries after restoring volume normally. After an unexpected termination, the next launch attempts to restore a matching active session without overwriting a newer manual volume change; unmatched entries remain for a later launch.
  • After a power loss or forced termination, restore the app manually through Windows Volume mixer if automatic recovery is unavailable.
  • Restart digital boost mode after changing the default output device.
  • Protected, elevated, sandboxed, or exclusive-mode applications may not expose audio for process-loopback capture.
  • Sessions must be active on the default console output device when LevelMate starts.

How it works

LevelMate discovers the target process tree's active sessions on the default output device and captures their peaks through WASAPI process loopback. Its AGC smooths gain changes toward -16 dBFS. Standard mode applies the result through application volume; digital boost mode applies it to captured PCM samples and rerenders them. On exit, LevelMate restores the original session volume.

Project layout

include/levelmate/       Public module interfaces
src/main.cpp             Executable entry point
src/app.cpp              Windows audio orchestration and lifecycle
src/audio_processing.cpp DSP, sample conversion, and audio buffering
src/cli.cpp              Command-line parsing and help text
src/recovery_data.cpp    Recovery serialization and matching policy
tests/main_tests.cpp     Native unit tests for the reusable core

About

CLI tool for real-time per-app audio normalization.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages