For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Record and play back

RecordingClient writes sample data to disk, plays it back, annotates it with markers, and exports it. Reach it as services.recording, or construct it standalone.

Method reference

Recording

Method
Payload
Response data

startRecording

{ recordingId, deviceId, sampleRate, numChannels, ... }

{ recordingId, batchSize, recordingDir }

writeBatch

{ recordingId, values, timestamps }

Empty

stopRecording

{ recordingId }

{ recordingId, totalSamples, totalDurationMs, numSegments }

getRecordingStatus

{ recordingId? }

{ recordingId, active, totalSamples }

Playback

Method
Payload
Response data

startPlayback

{ recordingId, channels? }

{ playbackId, recordingId, totalDurationUs, sampleRate, numChannels }

getNextBatch

{ playbackId }

{ values?, timestamps?, numSamples?, positionUs, speed?, state? }

pausePlayback

{ playbackId }

Empty

stopPlayback

{ playbackId }

Empty

seek

{ playbackId, timestampUs }

{ positionUs }

setPlaybackSpeed

{ playbackId, speed }

{ speed }

getPlaybackStatus

{ playbackId }

{ playbackId, state, positionUs, totalDurationUs, speed }

Management and markers

Method
Payload
Response data

listRecordings

{ deviceId?, kind?, search?, limit?, offset?, sortBy?, sortOrder? }

{ recordings, total }

getRecordingInfo

{ recordingId }

Full metadata and storage layout

updateMetadata

{ recordingId, updates }

Empty

deleteRecording

{ recordingId }

Empty

exportRecording

{ recordingId, format, location, includeFilters? }

{ format, folder, filePath, metaPath? }

addMarkers

{ recordingId, defs?, markers }

{ recordingId, written }

getMarkers

{ recordingId, fromUs?, toUs?, defIds?, source?, limit?, offset? }

{ defs, markers, total, returned, hasMore }

getMarkerDefs

{ recordingId }

{ defs }

deleteMarkers

{ recordingId, seqs? }

{ recordingId, removed }

Note: Every playback position and marker time is microseconds since the start of the recording, deliberately not wall-clock, so nothing needs re-anchoring when a recording is replayed later.

Record a session

Write batches of batchSize samples per channel to match the segment layout.

kind tags what produced the recording and decides which screen lists it. The service defaults it to "stream". The type is open-ended, so a new producer can tag its recordings without an SDK change.

Write sample batches

values is channels-first, so values[channel][sample]. timestamps has one entry per sample.

Match the batch length to batchSize from the start response. The service sizes it against the segment layout, and matching it avoids partial row groups.

Stop

300,000 samples at 4 kHz is 75 seconds, split across five segment files.

Omit recordingId from getRecordingStatus to query the active recording.

Warning: A recording that is never stopped leaves its final segment unclosed. The samples are on disk, but the duration and segment index are incomplete, and playback of that segment fails.

Play back

Playback is pull-based: start a session, then call getNextBatch on your own cadence.

Pass channels to read a subset; omitting it reads every channel. Playback state is playing, paused, stopped, or completed.

Seek and change speed

seek returns the position actually reached, which is the nearest sample boundary rather than the exact request. Read positionUs from the response rather than assuming.

Browse recordings

kind accepts one tag or an array. sortBy accepts started_at, duration_ms, or total_samples.

getRecordingInfo adds the storage layout that listRecordings omits: the channel table, segmentDurationSec, rowGroupDurationSec, batchSize, and a segments array with each file's time span.

Warning: deleteRecording removes the files from disk. There is no undo and no trash folder.

Annotate with markers

Markers annotate the recorded timeline: a key press, a hardware trigger, an experiment epoch. The service stores when each fired and a label, and never interprets what they mean, which is why one API serves all three.

Markers use a dictionary and occurrence split. A definition describes a kind of marker once; each occurrence references it by defId. A 1500-epoch run carries a handful of definitions rather than 1500.

Definition field
Description

id

Referenced by an occurrence's defId; stable within a recording

name

Display label

color

Display colour

kind

"event" for a point in time, "epoch" for a span

source

Origin, uninterpreted by the service

Occurrence field
Description

seq

Ordinal; assigned by the service when omitted

defId

Definition this references

tUs

Microseconds from the start of the recording

durUs

Duration; 0 or omitted means a point event

data

Free-form payload, never interpreted

Always batch. Re-sending defs on every batch is safe, because definitions upsert, which keeps each batch self-contained. addMarkers is callable while the recording is still active.

Supply seq explicitly to replace an existing occurrence, which makes a retry idempotent. Without it, retrying a failed batch appends duplicates.

Read markers

fromUs and toUs are inclusive. limit defaults to 500. The defs legend comes back only when offset is 0 or absent, since it is constant for a recording.

Warning: deleteMarkers with no seqs, or an empty array, deletes every marker for the recording along with its definitions.

Export

Format
Output

csv

A .csv file plus a meta.json sidecar

edf

An .edf file

edf+

An .edf file with annotations

The export lands in {location}/{recordingId}/. Export a stopped recording: exporting an active one captures only the segments closed so far.

Next steps

Last updated

Was this helpful?