edytlab
API Reference

Session, Preview and Markers

Read the session graph, move the head, render previews and A/B compares, set the selection and markers, and cut by transcript.

On this page18 commands

Called through tauri-bridge.ts. Each returns Promise<T> and throws a string on Rust Err(_).

Session Graph

FunctionReturnsDescription
getSessionHead()NodeIdReturns the current head node ID.
getNode(id)SessionNodeFetch a full node (including SessionState) by ID.
getGraph()GraphSummaryFetch all nodes (without full state) and the current head.
setHeadTo(nodeId)NodeIdMove the head pointer to any existing node (non-destructive revert).
renameNode(nodeId, label)voidSet a human-readable label on a node.

Rendering and A/B

FunctionReturnsDescription
renderPreview(node)string (path)Render the session to a WAV for playback. Cached by node id under .audiograph/previews/, so repeating a head — undo, redo — costs nothing. The cache is capped; a mix bigger than the cap is an error. The file it returns is the mix the window plays, so it is held out of eviction, and outside the cap, until the next renderPreview replaces it or the project changes: a render made meanwhile (the agent's, an audition, a graph preview) cannot evict it, and the timeline can read it again when it remounts. If the file is gone anyway the window renders the node again, once.
getRenderWarnings(node)RenderWarning[]What a render of the node leaves out: every switched-on effect in a stored chain (a track's, a bus's, the master's) that the renderer cannot run in a chain yet. Read from the stored chains, so nothing is rendered. Empty when nothing is left out; the window shows each one above the timeline.
renderRange(node, startSec, endSec, outPath){ warnings }Render a time range to a specific output file. warnings is what the file was written without (getRenderWarnings' list for the node), [] when nothing was left out. Rejects, writing nothing, when outPath is audio the project reads (a recording it plays from, in any step of its history): choose another path.
prepareCompare(a, b){ a_path, b_path, a_warnings, b_warnings, compare_id }Pre-render two nodes for A/B comparison, with what each side's render leaves out. Each side is the preview cache's entry for its node (the file renderPreview returns for it), rendered only if it is not there already, and nothing is written outside the project. Both are kept from the cache's eviction, and outside its cap, until endCompare(compare_id) or the next compare, so two sides too long to fit in the cache together can still be compared. A side bigger than the cap on its own is an error.
endCompare(compareId)voidThe compare bar has closed: its two renders are ordinary cache entries again, and the cache is evicted back under its cap at once. Ending a compare that a newer one has replaced changes nothing.
acceptB(b)NodeIdAccept node B as the new session head.

Selection and Markers

FunctionReturnsDescription
setSelectionContext(range?)voidSet or clear the selection range. Injected as agent context on next turn.
addMarker(timeSec, name)NodeIdAdd a named point marker. Appends one node and returns the new head; the label's own ID is in listMarkers().
updateMarker(id, patch)NodeIdRename and/or move a label in one call. patch is { name?, time?, start?, end? }: time moves a point marker there, and a region starts there and keeps its length; start and end set a region's bounds outright and are sent together, never with time. A change that changes nothing appends no node and returns the head unchanged. Refuses a time below 0 or not finite, a start without an end, and end <= start.
removeMarker(id)NodeIdRemove a marker by annotation ID. Returns the new head.
listMarkers()Marker[]List all markers and regions for the current session.

Transcript

FunctionReturnsDescription
getTranscript()TranscriptThe transcript at the current head, and where it came from: { words, source }, with words as { text, start_sec, end_sec, confidence } and source one of { kind: "track", track }, { kind: "file" }, { kind: "gone" } or { kind: "unknown" }. No words until transcribe has run (the Transcript tab re-reads it on every head move, so a transcription the assistant makes appears as its node arrives). A word's time is seconds of the audio it was made from, so the Transcript tab cuts a track by it only if the transcript is of that track (source.kind is "track").
cutTranscriptWords(track, fromWord, toWord)NodeIdCut the half-open word range [fromWord, toWord) and the audio underneath it, closing the gap. Indices are into the array getTranscript() returned; re-read it afterwards, since the words after the cut renumber. track is the transcript's own track (getTranscript().source.track): the cut_words tool the command runs refuses any other track. Refuses a track out of range, no transcript, a track that is not the one the transcript is of (or that has been removed, or a transcript of a file), and an empty range or one past the end.