
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@supertiger/native-sound-mixer
Advanced tools
This node.js
project is a sound mixer for node desktop apps providing control over volume for each render/capture device (I/O devices) and for each audio session in an audio device separately.
The native c++
code is provided in cppsrc/
and compiled using node-addon-api
postinstall scripts will automatically build bin files
This is a Node js package available through npm registry.
pulseaudio
server (already installed on most user-friendly distros)> npm install native-sound-mixer
or using yarn :
> yarn add native-sound-mixer
SoundMixer: factory, default export
Device: Represents a physical/virtual device with channels and volume controls
readonly
read-write
read-write
read-write
AudioSession: Represents an app-linked audio channel with volume controls
read-write
read-write
read-write
this function returns all the devices
found by the system.
import SoundMixer, {Device} from "native-sound-mixer";
const devices: Device[] = SoundMixer.devices;
returns the default device for the specified DeviceType
, if none found returns undefined.
import SoundMixer, {Device, DeviceType} from "native-sound-mixer";
const device: Device | undefined = SoundMixer.getDefaultDevice(DeviceType.RENDER);
class Device {
private constructor(); // Device instantiation is disallowed
public volume: VolumeScalar;
public mute: boolean;
public readonly name: string;
public readonly type: DeviceType;
public readonly sessions: AudioSession[];
}
returns all the AudioSessions
linked to the Device
.
// import ...
let device: Device;
// set device to any valid Device object.
const sessions: AudioSession[] = device.sessions;
gets and sets mute
value for the device.
// import ...
// retrieving the mute flag
const mute: boolean = device.mute;
// toggling mute
device.mute = !mute;
gets and sets the volume scalar
for the device.
// import ...
// retrieving the volume
const volume: VolumeScalar = device.volume;
// adding 10% to volume
device.volume += .1;
gets and sets the volume balance
for the device.
// import ...
// retrieving the volume
const balance: VolumeBalance = device.balance;
// sets right VolumeScalar to 1 and left VolumeScalar to .5
// by default, left and right are equal to the VolumeScalar of the device
device.balance = {right: 1, left: .5};
// class declaration
class AudioSession {
private constructor(); // AudioSession instantiation is disallowed
public volume: VolumeScalar;
public mute: boolean;
public readonly name: string;
public readonly appName: string;
}
sets and gets the mute flag for the AudioSession
.
// import ...
let session: AudioSession;
// set session to a valid session object
const mute: boolean = session.mute;
// toggling mute
session.mute = !mute;
sets and gets the VolumeScalar
for the AudioSession
.
// import ...
let session: AudioSession;
// set session to a valid session object
const volume: VolumeScalar = session.volume;
// adding 10% to volume
session.volume += .1;
gets and sets the volume balance
for the device.
// import ...
// retrieving the volume
let session: AudioSession;
const balance: VolumeBalance = session.balance;
// sets right VolumeScalar to 1 and left VolumeScalar to .5
// by default, left and right are equal to the VolumeScalar of the session
session.balance = {right: 1, left: .5};
a clamped float betwen 0 and 1 representing the power of the volume, 1 is max power and 0 is no output.
a structure representing the stereo balance for a device and an audio session
interface VolumeBalance {
right: Number; // float
left: Number; // float
stereo: Boolean; // only for Device::balance
}
an enumeration representing the state of the audio session. Possible values are
import {AudioSessionState} from "native-sound-mixer";
AudioSessionState.INACTIVE; // session is incative but valid
AudioSessionState.ACTIVE; // session is active
AudioSessionState.EXPIRED; // session no longer exists or is no longer available
an enumeration representing the type of the device. Possible values are :
import {DeviceType} from "native-sound-mixer";
DeviceType.RENDER; // device type is output
DeviceType.CAPTURE; // device type is input
DeviceType.ALL; // device type is both input and output
As an open-source project, every one is free to modify the codebase. Feel free to open any discussion or issue or PR to improve this project.
This project is under MIT license
FAQs
node js native sound mixer module
We found that @supertiger/native-sound-mixer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.