Skip to main content
Follow along with the runnable example. This guide walks through the Audio archive example in corti-examples — bootstrap your build from it or use it as reference.
Some workflows need to keep the audio a user dictated — for playback, quality review, or later re-transcription. This guide shows where to capture that audio and how to persist it while streaming to Corti. It builds on the raw-SDK path from the Microphone guide, where your app owns MediaRecorder directly — that’s the point at which each audio chunk is available to both send and keep.

Tee each chunk

The only change from a plain raw-SDK session is what you do in ondataavailable: append the chunk to a local archive and send it to Corti. Both consume the same blob.
JavaScript

Session lifecycle

Model recording as a session with three controls, so a user can pause and resume without dropping the connection: The key detail is flushing before you pause or end: calling socket.sendFlush() tells the server to return transcripts for audio it has already received, so nothing is lost at the boundary.
JavaScript
Call socket.sendFlush() after pausing — the server returns any buffered transcripts and then a flushed message signalling completion. See the audio archive example in corti-examples for the full socket flush implementation.

Finalize the archive

On End session, assemble the collected chunks into a single Blob using the recorder’s actual MIME type, then build a playback/download URL.
JavaScript
Capture a little metadata alongside the blob so the archive is useful later — the device label, the actual capture MIME, segment start/end reasons and durations, and total chunk/byte counts. Derive the file extension from the MIME type (audio/webm.webm, audio/mp4.m4a) and give the file a timestamped name.
This example stores audio in the browser for demonstration. In production, dictation audio is often sensitive — persist it to a secure server-side store, and apply your organization’s retention and access policies rather than keeping it client-side.

Next steps

Microphone

The raw-SDK capture path this archive builds on.

File Transcription

Re-transcribe an archived recording offline via /transcripts.

Example code

The complete, runnable Audio archive example in corti-examples.
Please contact us for help or questions.