On this page
Overview
Connects one microphone lifetime to one retained Core transcription stream without deciding conversational turns.
- Artifact
NativeSpeechCapture.js· esm - Classification
public first party - Availability
Browser / native WebView with microphone, AudioWorklet and selected streaming Core speech - Normalization
Exact ordered mono PCM at the actual declared rate; complete provisional/final snapshots and callback controls. forceEndpoint flushes audio and recognition while preserving capture and stream scope; stop drains terminally; cancel joins capture/native cleanup without claiming a complete transcript.
Import and lifecycle
import nativeSpeechCapture from '/node_modules/arcane-os/runtime/arcane/modules/NativeSpeechCapture.js';
Construction opens no microphone or model. Explicit start opens one capture graph and one Core recognition stream; endpoint retains them, stop drains and closes them, and cancellation joins both cleanup owners.
Application-facing behavior: default createNativeSpeechCapture({speech,model,sampleRate=16000,pcmChunkMs=100,activityThreshold=0.02,streamOptions,mediaConstraints,onUpdate,onInterim,onSegment,onActivity,onState,onError,onProgress,onRequest}); returns start({signal,mediaConstraints}), forceEndpoint(), stop(), requestStop(), cancel(reason), destroy(reason), done and current(). Recognition callbacks receive (result,{requestStop}); request a stop then return, and join externally. No implicit model load, conversation reply or fallback.
Protocol and host implementation
ContinuousVoiceCapture PCM and Arcane.speech.openStream 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 · function | function createNativeSpeechCapture({speech, model, ...options}) | {speech, model, ...options} |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
default | exported-function | function createNativeSpeechCapture({speech, model, ...options}) | {speech, model, ...options} |
Parameter meanings and results
createNativeSpeechCapture({speech,model,sampleRate=16000,pcmChunkMs=100,activityThreshold=0.02,streamOptions,mediaConstraints,onUpdate,onInterim,onSegment,onActivity,onState,onError,onProgress,onRequest}) returns start({signal,mediaConstraints}), forceEndpoint, stop, requestStop, cancel(reason), destroy(reason), done and current. Start resolves boolean. Exact mono Float32 PCM uses the declared actual rate; complete native snapshots are preserved. Callbacks receive (result,{requestStop}); requestStop requests a terminal drain without joining it. External callers join stop or done and invoke forceEndpoint outside recognition callbacks. Partial snapshots replace; finals remain distinct segments, never inferred conversation completion.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- onUpdate for every snapshot, then onSegment for final or onInterim for provisional
- onActivity and onState describe capture only
- onProgress and onRequest preserve Core metadata
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- Original capture, native, callback and cleanup failures remain observable through done and onError.
- A capture/native sample-rate mismatch reports an error without reinterpreting samples.
Availability and capabilities
Browser / native WebView with microphone, AudioWorklet and selected streaming Core speech. Exact ordered mono PCM at the actual declared rate; complete provisional/final snapshots and callback controls. forceEndpoint flushes audio and recognition while preserving capture and stream scope; stop drains terminally; cancel joins capture/native cleanup without claiming a complete transcript.
Browser microphone and AudioWorklet plus an explicitly selected ready streaming Core speech engine. No chat dispatch, persistence, semantic endpoint detector or fallback.
Contract example
import createNativeSpeechCapture from 'arcane-os/modules/NativeSpeechCapture.js';
function prepareDragonInterpreter(speech, model, showSnapshot) {
return createNativeSpeechCapture({speech, model, onUpdate: showSnapshot});
}
// The owning user action starts the returned capture; the owner joins stop/done.
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.