sw-synth
Version:
Lightweight sound synthesizer designed for real-time user interaction using the Web Audio API
13 lines (12 loc) • 723 B
TypeScript
import { VoiceBase, VoiceBaseParams } from './base';
export type BufferFactory = (context: BaseAudioContext, frequency: number, velocity: number) => AudioBufferSourceNode;
/** Parameters for the audio buffers of the synth. */
export interface BufferVoiceParams extends VoiceBaseParams {
/** A function that returns unstarted [AudioBufferSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode) when queried with context, frequency and velocity. */
factory: BufferFactory;
}
export declare class BufferVoice extends VoiceBase {
node?: AudioBufferSourceNode;
noteOn(frequency: number, velocity: number, noteId: number, params: BufferVoiceParams): () => void;
dispose(): void;
}