@saraudio/capture-node
v0.2.6
Published
Cross-platform Node.js capture entrypoint for SARAudio (macOS supported; Windows/Linux coming later)
Maintainers
Readme
@saraudio/capture-node
Cross-platform capture entrypoint for Node.js.
- macOS: delegates to
@saraudio/capture-darwin(Swift/CoreAudio) - Windows/Linux: not supported yet (will throw on
start())
Install
pnpm add @saraudio/capture-nodeOn macOS you also need:
pnpm add @saraudio/capture-darwinUsage
import { createMicrophoneSource, createSystemAudioSource, listMicrophoneDevices } from '@saraudio/capture-node';
// Optional: pick a specific microphone by CoreAudio device UID.
const devices = await listMicrophoneDevices();
const deviceUID = devices[0]?.uid;
const mic = createMicrophoneSource({ deviceUID });
const system = createSystemAudioSource();
await mic.start((frame) => {
// frame.pcm is Int16Array (PCM16LE), frame.sampleRate = 16000, frame.channels = 1
});
await system.start((frame) => {
// system audio frames have the same format (PCM16LE / 16 kHz / mono)
});