This is a part of Node3D project.
npm install @node-3d/webaudioNode.js addon implementing the Web Audio Api.
Import any class you like from the module and then follow the doc:
import { AudioContext } from '@node-3d/webaudio'; // usually this is enoughCreate a silent PCM buffer using the Web Audio arguments, then write samples:
const context = new AudioContext();
const buffer = context.createBuffer(1, context.sampleRate, context.sampleRate);
const samples = buffer.getChannelData(0);
samples[0] = 0.5;new AudioBuffer({ length, sampleRate, numberOfChannels? }) is also supported.
createBuffer() requires all three arguments. Invalid buffer dimensions and
sample rates throw NotSupportedError; an invalid channel index throws
IndexSizeError.
This module is WORK IN PROGRESS. Unimplemented or noncompliant Web Audio behavior remains work to fix.
Currently exported classes:
AudioBufferAudioContextAudioParamAnalyserNodeBiquadFilterNodeConvolverNodeGainNodePannerNodeAudioBufferSourceNodeOscillatorNodeAudioScheduledSourceNode
In examples directory, currently working examples are prepended with _.
Release archives are built by this repository's public GitHub Actions workflows.
Attestations: https://github.com/node-3d/webaudio/attestations
To verify a downloaded archive:
gh release download <tag> -R node-3d/webaudio -p <platform>.gz
gh attestation verify <platform>.gz -R node-3d/webaudioThis addon is ABI-compatible across Node.js versions. There is no compilation during
npm install.