Skip to content

AppVolume Addon

Read and control Windows audio sessions per application — ideal for per-app volume sliders and mute toggles.

javascript
import { addon } from "novadesk";
const appVolume = addon.load("path/to/AppVolume.dll");

INFO

This API comes from the AppVolume addon, not the built-in system module.

Table of Contents


appVolume.listSessions() #
AppVolume

Returns all active Windows output audio sessions. Each session maps to an application currently playing (or having recently played) audio.

Each session object has:

Property Type Description
pid number Process ID.
processName string Executable file name (e.g. chrome.exe).
fileName string Executable file name.
filePath string Full executable path when available.
iconPath string Extracted .ico path cached in temp, or empty string.
displayName string Session display name.
volume number Session volume 0.0–1.0.
peak number Peak level 0.0–1.0.
muted boolean Whether the session is muted.
RETURNS: object[] Array of audio session objects. Returns an empty array if enumeration fails.
javascript
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);
}

appVolume.getByPid(pid) #
AppVolume

Gets aggregated volume details for all sessions belonging to a process ID. Returns the average volume, peak maximum, and whether any session is muted.

The returned object has: volume (average, 0.0–1.0), muted (true if any session is muted), peak (maximum peak).

PARAMETERS

pid number
Target process ID. Must be greater than 0.
RETURNS: object | null Aggregated volume info for matching sessions, or null if no session matches the PID.
javascript
const s = appVolume.listSessions()[0];
const info = appVolume.getByPid(s.pid);
if (info) {
  console.log("Volume:", info.volume, "Muted:", info.muted);
}

appVolume.getByProcessName(name) #
AppVolume

Same as getByPid() but matches by process name. Case-insensitive.

PARAMETERS

name string
Process name to match (case-insensitive), e.g. chrome.exe.
RETURNS: object | null Aggregated volume info for matching sessions, or null if no session matches the name.
javascript
const info = appVolume.getByProcessName("Spotify.exe");
if (info) console.log("Spotify volume:", info.volume);

appVolume.setVolumeByPid(pid, volume01) #
AppVolume

Sets the volume for all audio sessions belonging to a process ID.

PARAMETERS

pid number
Target process ID. Must be greater than 0.
volume01 number
Target volume 0.0–1.0. Values outside this range are clamped.
RETURNS: boolean true if at least one matching session was updated, false otherwise.
javascript
const s = appVolume.listSessions()[0];
appVolume.setVolumeByPid(s.pid, 0.5); // 50%

appVolume.setVolumeByProcessName(name, volume01) #
AppVolume

Sets the volume for all audio sessions matching a process name.

PARAMETERS

name string
Process name to match (case-insensitive).
volume01 number
Target volume 0.0–1.0. Values outside this range are clamped.
RETURNS: boolean true if at least one matching session was updated, false otherwise.
javascript
appVolume.setVolumeByProcessName("chrome.exe", 0.3); // 30%

appVolume.setMuteByPid(pid, mute) #
AppVolume

Mutes or unmutes all audio sessions belonging to a process ID.

PARAMETERS

pid number
Target process ID. Must be greater than 0.
mute boolean
true to mute, false to unmute.
RETURNS: boolean true if at least one matching session was updated, false otherwise.
javascript
const s = appVolume.listSessions()[0];
appVolume.setMuteByPid(s.pid, true);

appVolume.setMuteByProcessName(name, mute) #
AppVolume

Mutes or unmutes all audio sessions matching a process name.

PARAMETERS

name string
Process name to match (case-insensitive).
mute boolean
true to mute, false to unmute.
RETURNS: boolean true if at least one matching session was updated, false otherwise.
javascript
appVolume.setMuteByProcessName("Spotify.exe", true);

Full Example

javascript
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);

  appVolume.setVolumeByProcessName(first.processName, 0.5);
  appVolume.setMuteByPid(first.pid, false);

  const agg = appVolume.getByPid(first.pid);
  console.log("Aggregated:", agg);
}