Follow along with the runnable example. This guide walks through the Raw SDK mic example in
corti-examples — bootstrap your build from it or use it as reference.How it works
The SDK wraps the Transcribe WebSocket with a promise-basedconnect(). The flow is:
Construct the client
Create a
CortiClient with your auth. See the raw SDK mic example in corti-examples for the setup code.Connect and send configuration
Call
client.transcribe.connect({ configuration }). The promise resolves only after the server returns CONFIG_ACCEPTED, so audio is never sent before the handshake completes.Stream audio frames
Capture the microphone with
MediaRecorder and pass each chunk’s arrayBuffer() to socket.sendAudio().Prerequisites
- The Corti SDK:
npm install @corti/sdk - A token source that returns
{ accessToken, expiresIn }. See the Authentication guide for the available flows.
corti-examples for client construction and socket connection — the examples below focus on the audio capture side.
Capture the microphone
Request the microphone withgetUserMedia, then feed MediaRecorder output to the socket. A short timeslice (100–250 ms) keeps latency low.
JavaScript
Stop and clean up
On stop or unmount, stop the recorder and release the microphone tracks. Also close the SDK socket so the session ends cleanly.JavaScript
Next steps
Text Insertion
Insert transcripts into a target field with correct spacing and casing.
Dictation Web Component
Skip manual mic handling with a prebuilt, styleable dictation UI.
Example code
The complete, runnable Raw SDK mic example in
corti-examples.Please contact us for help or questions.