edytlab
API Reference

Tracks and Recording

List and edit tracks and clips, sync-lock and envelopes, and record from the microphone.

On this page17 commands

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

Tracks

FunctionReturnsDescription
batchLoad(paths)BatchLoadResultLoad several audio files in one call, each as its own track. Each file is its own node, so undo takes back one at a time. Resolves with { tracks_loaded, last_node_id, failures }: a file the load tool refuses lands in failures with its reason, leaves no node behind, and does not stop the rest.
listTracks()TrackSummary[]List all tracks in the current session head. A project with no history yet rejects with NoSession, which is not a fault: the app (isNoSession) reads it as an empty list.
renameTrack(track, name)NodeIdRename a track. Returns the new head.
removeTrack(track)NodeIdDelete a track and everything on it. An ordinary session node, so it undoes like any other edit, which is why the window does not confirm first.
duplicateTrack(track)NodeIdCopy a track, with its clips, gain, pan and effects, as a new track at the end.
setTrackGain(track, gainDb)NodeIdSet a track's gain in dB. Absolute, not relative.
setTrackPan(track, pan)NodeIdSet a track's pan: -1 hard left, 0 centre, 1 hard right.
setTrackMuted(track, muted)NodeIdMute or unmute a track. Returns the new head.
setTrackSoloed(track, soloed)NodeIdSolo or unsolo a track. Soloing silences the others at render time without changing their muted flags, so un-soloing puts everything back as it was.
getSyncLock()booleanWhether an edit that shifts time on one track shifts them all. It belongs to the session, not to a track, so the toggle can show the right state the moment a project opens.
setSyncLock(enabled)NodeIdTurn sync lock on or off. Resolves to the new head, or to the unchanged one when the value did not change.
moveClip(track, clip, startSec)NodeIdMove one clip to a new start, in seconds from the top of the timeline; the other clips stay put. Clips are re-sorted by start afterwards, so a clip dragged past its neighbour comes back at a different index: re-read listTracks() before addressing it again.
removeClip(track, clip)NodeIdRemove one clip, leaving a silent gap where it was. The other clips do not move.
setClipEnvelope(track, clip, points)NodeIdReplace a clip's volume automation curve with points of { time_sec, gain_db }, the time in seconds from the clip's own start. An empty array clears it; the points need not be sorted.

Recording

FunctionReturnsDescription
startRecording()stringBegin capturing from the default input device.
stopRecording(outputPath)RecordingResultStop capture and write the take to a WAV file at outputPath. Resolves with { path, sample_rate, channels }. The take is not added to the session: load it with batchLoad([path]). A failed write means the take is gone; a failed import means it is on disk at the path this returned.
timerRecord(outputPath, schedule){ path?, cancelled }Record on a timer: wait startAfterSec, then capture for durationSec. Both are optional; omitting startAfterSec starts now, and omitting durationSec records until stopped. cancelled is true when cancelLongRunningTool() ended it early, and path may then be absent. Emits tool-progress events throughout.