AppVolume Addon
Read and control Windows audio sessions per application. For system-wide volume, see the audio module — ideal for per-app volume sliders and mute toggles.
What is AppVolume?
The AppVolume addon lets you interact with every app that is currently playing sound on your computer. You can:
- List all active audio sessions (e.g. Chrome, Spotify, Discord)
- Get the current volume, peak level, and mute state for any app
- Set the volume or mute/unmute any app individually
Think of it like the Windows Volume Mixer, but from your NovaDesk widget script.
Getting Started
First, load the addon in your script:
import { addon } from "novadesk";
// Load the AppVolume addon DLL
const appVolume = addon.load("path/to/AppVolume.dll");TIP
Replace "path/to/AppVolume.dll" with the actual path to the AppVolume.dll file on your system. If the DLL is in the same folder as your script, you can use just "AppVolume.dll".
INFO
This API comes from the AppVolume addon, not the built-in system module.
Table of Contents
Quick Example
Here is a minimal example that lists all active audio sessions and prints their names and volumes:
import { addon } from "novadesk";
const appVolume = addon.load("path/to/AppVolume.dll");
// Get all apps currently playing audio
const sessions = appVolume.listSessions();
for (const s of sessions) {
console.log(`${s.processName}: volume ${Math.round(s.volume * 100)}%`);
}Returns all active Windows output audio sessions. Each session maps to an application currently playing (or having recently played) audio.
How it works internally: This function connects to the Windows audio session manager, enumerates every active session on the default audio output device, and collects details about each one.
Each session object has:
| Property | Type | Description |
|---|---|---|
pid | number | Process ID — a unique number Windows assigns to each running app. |
processName | string | Executable file name (e.g. chrome.exe). |
fileName | string | Executable file name (same as processName). |
filePath | string | Full executable path when available (e.g. C:\Program Files\...). |
iconPath | string | Path to a cached .ico file of the app's icon, or empty string if unavailable. |
displayName | string | Session display name set by the app. |
volume | number | Session volume from 0.0 (silent) to 1.0 (full volume). |
peak | number | Current audio peak level from 0.0 to 1.0. |
muted | boolean | Whether the session is muted. |
object[] Array of audio session objects. Returns an empty array if enumeration fails.const sessions = appVolume.listSessions();
console.log("Active sessions:", sessions.length);
for (const s of sessions) {
console.log(s.processName, "vol:", s.volume, "muted:", s.muted);
}Gets aggregated volume details for all sessions belonging to a process ID. If an app has multiple audio sessions (e.g. multiple tabs in a browser), this combines them into one result.
The returned object has:
| Property | Type | Description |
|---|---|---|
volume | number | Average volume across all matching sessions (0.0–1.0). |
muted | boolean | true if any matching session is muted. |
peak | number | Maximum peak level across all matching sessions. |
PARAMETERS
object | null Aggregated volume info for matching sessions, or null if no session matches the PID.const sessions = appVolume.listSessions();
const s = sessions[0];
// Get aggregated info by process ID
const info = appVolume.getByPid(s.pid);
if (info) {
console.log("Volume:", info.volume, "Muted:", info.muted);
}Same as getByPid() but matches by process name instead of PID. The comparison is case-insensitive, so "spotify.exe" and "Spotify.exe" both work.
PARAMETERS
object | null Aggregated volume info for matching sessions, or null if no session matches the name.const info = appVolume.getByProcessName("Spotify.exe");
if (info) console.log("Spotify volume:", info.volume);Sets the volume for all audio sessions belonging to a process ID.
PARAMETERS
boolean true if at least one matching session was updated, false otherwise.const s = appVolume.listSessions()[0];
appVolume.setVolumeByPid(s.pid, 0.5); // Set to 50%Sets the volume for all audio sessions matching a process name.
PARAMETERS
boolean true if at least one matching session was updated, false otherwise.appVolume.setVolumeByProcessName("chrome.exe", 0.3); // Set Chrome to 30%Mutes or unmutes all audio sessions belonging to a process ID.
PARAMETERS
boolean true if at least one matching session was updated, false otherwise.const s = appVolume.listSessions()[0];
appVolume.setMuteByPid(s.pid, true); // Mute this appMutes or unmutes all audio sessions matching a process name.
PARAMETERS
boolean true if at least one matching session was updated, false otherwise.appVolume.setMuteByProcessName("Spotify.exe", true); // Mute SpotifyFull Example
Here is a complete example that lists sessions, reads volume info, and demonstrates setting volume and mute:
import { addon } from "novadesk";
const appVolume = addon.load("path/to/AppVolume.dll");
const sessions = appVolume.listSessions();
if (sessions.length > 0) {
const first = sessions[0];
console.log("App:", first.processName, "Vol:", first.volume, "Muted:", first.muted);
// Set volume to 50%
appVolume.setVolumeByProcessName(first.processName, 0.5);
// Unmute the app
appVolume.setMuteByPid(first.pid, false);
// Read back the aggregated info
const agg = appVolume.getByPid(first.pid);
console.log("Aggregated:", agg);
}