Skip to content

Real-time Windows desktop application that automatically lowers music volume when study applications become active.

Notifications You must be signed in to change notification settings

NJ555/StudyMute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎧 StudyMute

A Windows desktop application that intelligently lowers music volume when study applications become active.


C# .NET 8 WPF Platform Release


📌 Overview

StudyMute is a Windows desktop application that monitors real-time audio activity from selected study applications (e.g., Zoom, Teams, Chrome) and automatically reduces the volume of configured music applications (e.g., Spotify).

When study audio stops, the original music volume is restored smoothly.

The application integrates directly with the Windows Core Audio API via managed interop for low-latency, system-level audio control.


✨ Key Features

  • 🎧 Real-time Windows audio session monitoring
  • 🔉 Automatic music volume fading during study activity
  • 🎚 Configurable fade duration and target volume
  • 🔄 Smooth volume restoration
  • ♻ Self-healing audio session reattachment
  • 🧠 Idempotent Start/Stop lifecycle handling
  • 🧵 Thread-safe background monitoring
  • 🧹 Clean uninstall support

🛡 Stability & Reliability (v1.0.2+)

Recent architectural hardening ensures:

  • Safe rapid Start → Stop → Start transitions
  • No duplicate CoreAudio callback registrations
  • Proper COM object lifecycle management
  • No monitoring loop ghost tasks
  • Memory-stable long-running operation
  • Correct device-switch handling (while running or stopped)
  • Clean session cache reset on restart

The monitoring pipeline is fully symmetric:

  • Stop cascades downward
  • Start rebuilds upward

Each layer (UI → Coordinator → Monitor → CoreAudio) enforces idempotent lifecycle behavior.


🏗 Architecture

The solution follows a layered architecture:

StudyMute/
├── src/
│ ├── StudyMute.Core/ # Domain logic & interfaces
│ ├── StudyMute.Infrastructure/ # Windows CoreAudio integration & services
│ └── StudyMute.UI/ # WPF MVVM application

Core

  • Domain models
  • Application contracts
  • Interface abstractions

Infrastructure

  • NAudio CoreAudio integration
  • Audio session monitoring
  • Activity detection engine
  • Volume control services
  • Thread-safe coordination logic

UI

  • WPF (.NET 8 Windows Desktop)
  • MVVM pattern
  • Lifecycle-controlled background orchestration

💻 Tech Stack

  • Language: C# 12
  • Framework: .NET 8 (Windows Desktop)
  • UI: WPF (MVVM)
  • Audio Interop: NAudio.CoreAudioApi
  • Logging: Serilog
  • Concurrency: Task, CancellationTokenSource, ConcurrentDictionary
  • Installer: Inno Setup
  • Testing: xUnit + Moq

🖥 System Requirements

  • Windows 10 / 11 (64-bit)
  • x64 architecture
  • Active audio output device

🚀 Installation (Recommended)

Windows Installer

  1. Visit:
    👉 https://github.com/NJ555/StudyMute/releases

  2. Download the latest installer:
    StudyMute_vX.X.X_Setup.exe

  3. Run the installer:
    Next → Install → Finish

The installer will:

  • Install StudyMute into Program Files
  • Create Start Menu entry
  • Optionally create Desktop shortcut
  • Register clean uninstall support

🛠 Build From Source

git clone https://github.com/NJ555/StudyMute.git
cd StudyMute
dotnet publish src/StudyMute.UI/StudyMute.UI.csproj -c Release -r win-x64 --self-contained true

Executable output:

src/StudyMute.UI/bin/Release/net8.0-windows/win-x64/publish/StudyMute.UI.exe


📖 Usage

  1. Launch StudyMute
  2. Add study applications (e.g., zoom, teams, chrome)
  3. Add music applications (e.g., spotify)
  4. Set fade duration and target volume
  5. Click Start Monitoring

When study audio is detected:
→ Music volume fades down

When study audio stops:
→ Music volume restores automatically


🧪 Testing

Lifecycle reliability is verified via automated tests:

  • Double Start protection
  • Double Stop protection
  • Repeated Start/Stop transitions
  • Coordinator idempotency validation

Run tests:

dotnet test


📦 Distribution

Each GitHub release includes:

  • Windows installer (.exe)
  • Versioned release notes
  • Production-ready self-contained build
  • Clean uninstall support

📄 License

MIT License

About

Real-time Windows desktop application that automatically lowers music volume when study applications become active.

Topics

Resources

Stars

Watchers

Forks

Languages