
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
iblokz-audio
Advanced tools
Web Audio API utilities and engine for building reactive audio applications
A lightweight, functional JavaScript library providing Web Audio API utilities for building reactive audio applications, synthesizers, and audio engines.
Part of the iblokz family of functional utilities, designed to work seamlessly with iblokz-state for reactive audio applications.
Requirements: Node.js ≥ 18.12.0
npm install iblokz-audio
# or
pnpm install iblokz-audio
This library is published as ESM-first with a CommonJS build for compatibility.
import * as a from 'iblokz-audio';
// or
import {vco, vca, adsr, connect, start, noteOn, noteOff} from 'iblokz-audio';
const a = require('iblokz-audio');
import {vco, vca, adsr, connect, start, noteOn, noteOff, context} from 'iblokz-audio';
// Create a simple oscillator
const vco = a.vco({ type: 'sine', freq: 440 });
const vca = a.vca({ gain: 0.5 });
const adsr = a.adsr({ attack: 0.1, release: 0.2 });
// Connect nodes: vco -> adsr -> vca -> destination
connect(vco, adsr);
connect(adsr, vca);
connect(vca, context.destination);
// Start the oscillator
start(vco);
// Trigger note on/off
noteOn(adsr, 0.7); // velocity 0.7
setTimeout(() => noteOff(adsr), 500);
import {vco, vcf, adsr, vca, connect, start, noteOn, noteOff, update, noteToFrequency, context} from 'iblokz-audio';
// Create a complete voice with filter and effects
const voice = {
vco1: vco({ type: 'sawtooth', freq: 440 }),
vco2: vco({ type: 'square', freq: 440, detune: 7 }),
vcf: vcf({ type: 'lowpass', cutoff: 0.5, resonance: 0.3 }),
adsr1: adsr({ attack: 0.1, decay: 0.2, sustain: 0.7, release: 0.3 }),
adsr2: adsr({ attack: 0.1, decay: 0.2, sustain: 0.7, release: 0.3 }),
vca: vca({ gain: 0.3 })
};
// Connect: VCOs -> ADSRs -> VCF -> VCA -> destination
connect(voice.vco1, voice.adsr1);
connect(voice.vco2, voice.adsr2);
connect(voice.adsr1, voice.vcf);
connect(voice.adsr2, voice.vcf);
connect(voice.vcf, voice.vca);
connect(voice.vca, context.destination);
// Play a note
const note = 'C4';
const freq = noteToFrequency(note);
update(voice.vco1, { freq });
update(voice.vco2, { freq });
start(voice.vco1);
start(voice.vco2);
noteOn(voice.adsr1, 0.8);
noteOn(voice.adsr2, 0.8);
import {create, lfo, vco, connect, start, context} from 'iblokz-audio';
// Create reverb effect
const reverb = create('reverb', {
seconds: 3,
decay: 2,
wet: 0.3,
dry: 0.7
});
// Create LFO for modulation
const lfoNode = lfo({
type: 'sine',
frequency: 2, // 2 Hz
gain: 10
});
// Connect source -> reverb -> destination
const osc = vco({ type: 'sine', freq: 440 });
connect(osc, reverb.input);
connect(reverb.output, context.destination);
// Start LFO and connect to modulate filter cutoff
start(lfoNode);
// lfoNode.output can be connected to modulate other parameters
import {connect, start, context, sampler} from 'iblokz-audio';
// Create a sampler instance
const sample = sampler.create('/path/to/sample.wav', null, { gain: 0.8 });
// When buffer is loaded, play it
sample.source.buffer.then(() => {
connect(sample, context.destination);
start(sample.source);
});
// Clone for polyphonic playback
const clone = sampler.clone(sample, { gain: 0.5 });
connect(clone, context.destination);
start(clone.source);
import { init, dispatch } from 'iblokz-state';
import {vca, connect, update, context} from 'iblokz-audio';
// Initialize state
const state$ = init({
voices: {},
volume: 0.5
});
// Create global volume control
const globalVolume = vca({ gain: 0.5 });
connect(globalVolume, context.destination);
// React to state changes
state$.subscribe(state => {
// Update global volume
update(globalVolume, { gain: state.volume });
// Handle note on/off
Object.keys(state.voices).forEach(note => {
if (!state.voices[note]) {
// Note off
// ... cleanup voice
}
});
});
// Dispatch note on
dispatch(state => ({
...state,
voices: { ...state.voices, 'C4': { velocity: 0.8 } }
}));
context - Web Audio API context instancecreate(type, prefs, ctx) - Create an audio nodeupdate(node, prefs) - Update node preferencesconnect(node1, node2) - Connect two nodesdisconnect(node1, node2) - Disconnect nodesreroute(node1, node2) - Reroute node to new destinationchain(...nodes) - Chain multiple nodesstart(node, ...args) - Start a nodestop(node, ...args) - Stop a nodenoteToFrequency(note) - Convert note name to frequencyvco(prefs) - Voltage Controlled Oscillatorvca(prefs) - Voltage Controlled Amplifiervcf(prefs) - Voltage Controlled Filteradsr(prefs) - ADSR Envelope Generatorlfo(prefs) - Low-Frequency OscillatornoteOn(adsr, velocity, time) - Trigger note onnoteOff(adsr, time) - Trigger note offimport {vco} from 'iblokz-audio';
const osc = vco({
type: 'sine' | 'square' | 'sawtooth' | 'triangle',
freq: 440, // Frequency in Hz
detune: 0 // Detune in cents
});
import {vca} from 'iblokz-audio';
const amp = vca({
gain: 0.5 // Gain level (0-1)
});
import {vcf} from 'iblokz-audio';
const filter = vcf({
type: 'lowpass' | 'highpass' | 'bandpass' | ...,
cutoff: 0.5, // Cutoff (0-1, mapped to frequency)
resonance: 0.3 // Resonance (0-1)
});
import {adsr} from 'iblokz-audio';
const envelope = adsr({
volume: 0.41, // Maximum volume
attack: 0.31, // Attack time (seconds)
decay: 0.16, // Decay time (seconds)
sustain: 0.8, // Sustain level (0-1)
release: 0.21 // Release time (seconds)
});
import {lfo} from 'iblokz-audio';
const modulator = lfo({
type: 'sine' | 'square' | 'sawtooth' | 'triangle',
frequency: 5, // LFO frequency in Hz
gain: 15 // LFO amplitude
});
import {create} from 'iblokz-audio';
const reverb = create('reverb', {
seconds: 3, // Reverb duration
decay: 2, // Decay factor
wet: 0.3, // Wet signal level (0-1)
dry: 0.7 // Dry signal level (0-1)
});
The library is organized into modules:
lib/core.js - Core Web Audio API utilitieslib/controls/adsr.js - ADSR envelope generatorlib/effects/lfo.js - Low-frequency oscillatorlib/effects/reverb.js - Reverb effectlib/sources/sampler.js - Audio sample playerThis library is designed for:
This library was extracted from and is used in:
# Install dependencies
pnpm install
# Build CommonJS bundle
pnpm build
# Run tests
pnpm test
# Run linter
pnpm run lint
# Generate documentation
pnpm run docs
For detailed API documentation, see API.md.
To generate the API documentation locally:
npm run docs
Contributions are welcome! Please read CONTRIBUTING.md for details.
git checkout -b feat/amazing-feature)git commit -m 'feat: add amazing feature')git push origin feat/amazing-feature)MIT © iblokz
FAQs
Web Audio API utilities and engine for building reactive audio applications
We found that iblokz-audio demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.