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.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 inondataavailable: 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 singleBlob using the recorder’s actual MIME type, then build a playback/download URL.
JavaScript
audio/webm → .webm, audio/mp4 → .m4a) and give the file a timestamped name.
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.