renderClickTrack

fun renderClickTrack(samaSamplePath: String, beatSamplePath: String, bpm: Float, beatsPerCycle: Int, durationMs: Int, sampleRate: Int = 16000): AudioRawData?

Render a fixed-length click track to PCM for sample-locked playback.

Unlike the live metronome (a wall-clock timer that free-runs on its own clock), this returns a single buffer whose beats sit at sample-accurate offsets. Mixed as a track in SonixMixer alongside a reference/lesson track, it stays phase-locked to that reference and cannot drift — the correct way to click over an accompanied exercise.

Runs a synchronous decode of the sama/beat samples; call off the main thread. The samples must already be at sampleRate (mono PCM16 WAV).

Return

the click track, or null if the samples can't be decoded / inputs invalid

Parameters

samaSamplePath

Path to the downbeat (beat 0 of each cycle) sample

beatSamplePath

Path to the regular-beat sample

bpm

Tempo in beats per minute (> 0)

beatsPerCycle

Beats per cycle; sama plays on index 0

durationMs

Total length of the rendered track in milliseconds

sampleRate

Output sample rate (default 16000; must match the samples)