addTrack

suspend fun addTrack(name: String, filePath: String): Boolean

Add track from file path (auto-decodes).

This is the recommended way to add tracks. The file is automatically decoded from its format (MP3, M4A, WAV, etc.) to PCM.

Return

true if track was added successfully

Parameters

name

Unique name for this track

filePath

Path to audio file


fun addTrack(name: String, data: ByteArray, sampleRate: Int, channels: Int, pitchExempt: Boolean = false): Boolean

Add track from raw PCM data (for advanced use cases).

Use this when you have pre-decoded audio data or need to load audio from a custom source.

Return

true if track was added successfully

Parameters

name

Unique name for this track

data

PCM audio data (16-bit signed samples)

sampleRate

Sample rate in Hz

channels

Number of channels (1 = mono, 2 = stereo)

pitchExempt

When true, pitch does NOT transpose this track — it plays at its original pitch. Use for percussive material (e.g. a metronome click) that a tempo-preserving shifter would smear. Musical tracks (reference, backing) leave this false so they follow the shruti shift.