On this page
Overview
Owns continuous microphone capture with complete ordered PCM or rolling pre-roll, activity-triggered pause/periodic segments, complete WAV delivery, final flush, and cancellation.
- Artifact
ContinuousVoiceCapture.js· esm - Classification
public first party - Availability
Browser / native WebView with getUserMedia, AudioContext, and AudioWorklet - Normalization
mode:pcm transfers every sample in ordered Float32Array records with actual sampleRate/channels/sequence; amplitude activity reports no semantic speech decision and never gates PCM. flush joins earlier PCM delivery without closing capture. Stop/cancel/destroy join accepted PCM and actual AudioContext close, surfacing failures. In the default segments mode: Complete mono Float32 WAV Blob segments with session-local sequence, pause/periodic/stop reason, and durationMs. Sound amplitude drives segmentation without semantic speech recognition. Inactive audio produces no segment, and periodic segments do not reuse samples. Stop releases microphone tracks immediately and waits for final flush; cancel releases capture and suppresses late callbacks.
Import and lifecycle
import continuousVoiceCapture from '/node_modules/arcane-os/runtime/arcane/modules/ContinuousVoiceCapture.js';
Explicit start requests microphone permission, creates one Web Audio capture graph, loads the static sibling worklet, and owns its stream, audio context, port, and signal. Stop releases the microphone immediately and waits for final worklet flush, accepted PCM delivery and actual AudioContext close. Cancel or destroy joins cleanup, releases owned resources and suppresses late segments, including after pending startup settles.
Application-facing behavior: default ContinuousVoiceCapture; constructor({preRollMs=1500,quietMs=2000,chunkMs=30000,activityThreshold=0.02,mode=segments,pcmChunkMs=100,onSegment,onPCM,onActivity,onError,onState}); start({mediaConstraints={audio:true},sampleRate,signal}={}) resolves boolean; flush() resolves after pending PCM delivery; stop() resolves after final flush and close; cancel() and destroy() release the owned session.
Protocol and host implementation
Native microphone and Web Audio lifecycle; internal VoiceCaptureWorklet MessagePort This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
default | default · class | class ContinuousVoiceCapture | — |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
ContinuousVoiceCapture.constructor | constructor | constructor(
{
preRollMs = 1500,
quietMs = 2000,
chunkMs = 30000,
activityThreshold = 0.02,
mode = 'segments',
pcmChunkMs = 100,
onSegment,
onPCM,
onActivity,
onError,
onState
} = {}
) |
{
preRollMs = 1500,
quietMs = 2000,
chunkMs = 30000,
activityThreshold = 0.02,
mode = 'segments',
pcmChunkMs = 100,
onSegment,
onPCM,
onActivity,
onError,
onState
} = {}
|
ContinuousVoiceCapture.start | async method | async start(
{
mediaConstraints = {audio: true},
sampleRate,
signal
} = {}
) |
{
mediaConstraints = {audio: true},
sampleRate,
signal
} = {}
|
ContinuousVoiceCapture.stop | method | stop() | — |
ContinuousVoiceCapture.cancel | method | cancel() | — |
ContinuousVoiceCapture.flush | method | flush() | — |
ContinuousVoiceCapture.destroy | method | destroy() | — |
Parameter meanings and results
ContinuousVoiceCapture({preRollMs=1500,quietMs=2000,chunkMs=30000,activityThreshold=0.02,mode=segments,pcmChunkMs=100,onSegment,onPCM,onActivity,onError,onState}); start({mediaConstraints={audio:true},sampleRate,signal}={}) resolves boolean; flush() joins preceding PCM delivery without closing capture; stop() resolves after flush, delivery and context close; cancel() and destroy() release the owned session. mode:pcm delivers every original sample through ordered awaited onPCM({samples:Float32Array,sampleRate,channels:1,sequence}); activity reports {active,audioTime} without selecting or dropping PCM. pcmChunkMs is transport scheduling, never a recording limit. Sample rate is the actual context rate. In the default segments mode, onSegment receives complete {audio:Blob,sequence,reason,durationMs}, with mono Float32 audio/wav, session-local 1-based sequence, and pause/periodic/stop reason. Inactive capture emits no segment, pre-roll is used once, and periodic segments do not repeat samples. Activity is amplitude detection, not semantic speech recognition.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- onSegment for each complete captured clip
- onPCM for ordered complete PCM and onActivity for amplitude state
- onState: starting, listening, stopped, interrupted
- onError with the original capture error
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- Original microphone, Web Audio, worklet, and callback failures are reported through the capture owner.
Availability and capabilities
Browser / native WebView with getUserMedia, AudioContext, and AudioWorklet. mode:pcm transfers every sample in ordered Float32Array records with actual sampleRate/channels/sequence; amplitude activity reports no semantic speech decision and never gates PCM. flush joins earlier PCM delivery without closing capture. Stop/cancel/destroy join accepted PCM and actual AudioContext close, surfacing failures. In the default segments mode: Complete mono Float32 WAV Blob segments with session-local sequence, pause/periodic/stop reason, and durationMs. Sound amplitude drives segmentation without semantic speech recognition. Inactive audio produces no segment, and periodic segments do not reuse samples. Stop releases microphone tracks immediately and waits for final flush; cancel releases capture and suppresses late callbacks.
Browser and supported native-WebView microphone capture with AudioWorklet. No model, transcription, persistence, application policy, or implicit Core service.
Contract example
import ContinuousVoiceCapture from '/node_modules/arcane-os/runtime/arcane/modules/ContinuousVoiceCapture.js';
const capture=new ContinuousVoiceCapture({
onSegment:queueTranscription,
onError:showCaptureError
});
// Invoke from the application's recording action.
await capture.start();
await capture.stop();
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.