C API reference · Kjarni 0.2.8

transcriber

kjarni_transcriber_config_default

struct KjarniTranscriberConfig kjarni_transcriber_config_default(void);

Get default transcriber configuration.

kjarni_transcriber_new

enum KjarniErrorCode kjarni_transcriber_new(const struct KjarniTranscriberConfig *config, struct KjarniTranscriber **out);

Create a new Transcriber. Downloads the model on first use.

Safety

  • config must be null (defaults) or point to a valid config whose strings are null or nul-terminated.
  • out must be a valid, writable pointer.

kjarni_transcriber_free

void kjarni_transcriber_free(struct KjarniTranscriber *transcriber);

Free a Transcriber.

Safety

  • transcriber must be null, or a handle from kjarni_transcriber_new not already freed.

kjarni_transcriber_transcribe_file

enum KjarniErrorCode kjarni_transcriber_transcribe_file(const struct KjarniTranscriber *transcriber, const char *path, struct KjarniTranscription *out);

Transcribe an audio file (wav, mp3, flac or ogg).

Safety

  • transcriber must be a live handle; path a nul-terminated string.
  • out must be a valid, writable pointer. It is written on success and on failure; free it with kjarni_transcription_free either way.

kjarni_transcriber_transcribe_pcm

enum KjarniErrorCode kjarni_transcriber_transcribe_pcm(const struct KjarniTranscriber *transcriber, const float *samples, uintptr_t len, uint32_t sample_rate, struct KjarniTranscription *out);

Transcribe raw mono PCM samples in -1..1 at any sample rate; they are resampled to 16 kHz.

Safety

  • transcriber must be a live handle.
  • samples must point to len readable floats (it may be null when len is 0).
  • out must be a valid, writable pointer; free it with kjarni_transcription_free either way.

Kjarni runs the same engine on every platform: