mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 17:18:49 -04:00
* test(omnivoice): expose ignored duration controls Compile the real wrapper with a model-free engine fixture. Four failing assertions expose ignored duration, postprocessing, and validation. Assisted-by: nib:gpt-6-astra Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * feat(omnivoice): add bounded duration controls Validate request controls before reference reads or native output. Preserve engine defaults when controls are omitted. Bound forced single-shot duration to 30 seconds as wrapper resource policy. Exercise the real native boundary, streaming rejection, and defaults with synthetic PCM. Document quantization and postprocessing limits. Assisted-by: nib:gpt-6-astra Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * test(omnivoice): require fixture-free ordinary tests Expose the ordinary suite regression before isolating native fixtures. Require selected native tests to reject a missing fixture explicitly. Assisted-by: nib:gpt-6-astra Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(omnivoice): isolate native fixture tests Ordinary Go tests must run without a compiled native fixture. Select fixture specs explicitly in the dedicated gate while keeping parser tests ordinary and native checks mandatory. Assisted-by: nib:gpt-6-astra Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
42 lines
2.0 KiB
C++
42 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
extern "C" {
|
|
|
|
// Streaming PCM chunk callback. samples is mono float PCM at 24 kHz, valid
|
|
// only for the duration of the call. Return non-zero to continue, 0 to abort.
|
|
typedef int (*omni_pcm_chunk_cb)(const float *samples, int n_samples,
|
|
void *user_data);
|
|
|
|
// Load the LM (model_path) + codec (codec_path) GGUFs. use_fa / clamp_fp16
|
|
// map to ov_init_params. Returns 0 on success, non-zero on failure.
|
|
int omni_load(const char *model_path, const char *codec_path, int use_fa,
|
|
int clamp_fp16);
|
|
|
|
// Synthesize to a malloc'd float PCM buffer (caller frees via omni_pcm_free).
|
|
// ref_samples != null && ref_n > 0 => voice cloning (ref_text optional).
|
|
// instruct != null && non-empty => voice design. seed < 0 keeps the default
|
|
// MaskGIT seed. denoise toggles the <|denoise|> marker (only with a reference).
|
|
// duration_frames: 0 keeps defaults; 1..750 overrides generation frames.
|
|
// postprocess: -1 keeps defaults; 0 disables, 1 enables post filtering.
|
|
// The frame cap is wrapper resource policy, not a success guarantee.
|
|
// Writes the sample count to *out_n. Returns NULL on failure (out_n set to 0).
|
|
float *omni_tts(const char *text, const char *lang, const char *instruct,
|
|
const float *ref_samples, int ref_n, const char *ref_text,
|
|
long long seed, int denoise, int duration_frames, int postprocess, int *out_n);
|
|
|
|
// Streaming synthesis: cb is invoked per PCM chunk as audio is produced.
|
|
// Same semantics as omni_tts, but postprocess=0 is rejected. Returns 0 on success.
|
|
int omni_tts_stream(const char *text, const char *lang, const char *instruct,
|
|
const float *ref_samples, int ref_n, const char *ref_text,
|
|
long long seed, int denoise, int duration_frames, int postprocess, omni_pcm_chunk_cb cb,
|
|
void *user_data);
|
|
|
|
// Free a buffer returned by omni_tts.
|
|
void omni_pcm_free(float *p);
|
|
|
|
// Release the OmniVoice context.
|
|
void omni_unload(void);
|
|
}
|