Skip to main content

Class: MicrophoneCapture

The player's microphone, through the browser's own echo cancelling, noise suppression and gain control, as 20 ms frames.

Implements​

Constructors​

constructor​

• new MicrophoneCapture(): MicrophoneCapture

Returns​

MicrophoneCapture

Methods​

resume​

▸ resume(): void

Start capturing if the browser is holding it until a click or a key.

Returns​

void

Implementation of​

VoiceCapture.resume


start​

▸ start(deviceId, onFrame, onEnded): Promise<void>

Open the microphone and start handing 20 ms frames of mono samples at 48 kHz to onFrame. Rejects with a VoiceCaptureError.

Parameters​

NameType
deviceIdstring
onFrame(samples: Float32Array<ArrayBufferLike>) => void
onEnded() => void

Returns​

Promise<void>

Implementation of​

VoiceCapture.start


stop​

▸ stop(): void

Close the microphone. The browser's "in use" mark goes with it.

Returns​

void

Implementation of​

VoiceCapture.stop