mstar.model.omnivoice.components.codec#
Higgs-Audio-v2 codec wrappers: waveform <-> 8-row token canvas.
HiggsAudioV2TokenizerModel ships in transformers, so nothing is
re-implemented here — these are the two thin seams M* needs, plus the
post-processing the reference applies after decode.
The codec weights live in the OmniVoice checkpoint under audio_tokenizer/.
The standalone mirror is the fallback the reference falls back to, kept for
checkpoints published without the subfolder.
Functions
|
|
|
|
|
Load the codec from the checkpoint's subfolder, else the mirror. |
|
Silence trim, level match, fade and pad — the reference's tail. |
- mstar.model.omnivoice.components.codec.decode_canvas(codec, tokens)[source]#
[C, T_tok]tokens -> 1-D waveform atcodec.config.sample_rate.
- mstar.model.omnivoice.components.codec.encode_reference(codec, waveform)[source]#
[1, T]waveform at the codec’s rate ->[C, T_tok]tokens.The tail is clipped to a whole number of hops first, as the reference does: a partial hop would encode to a frame the decoder cannot place.
- mstar.model.omnivoice.components.codec.load_codec(model_path, cache_dir=None)[source]#
Load the codec from the checkpoint’s subfolder, else the mirror.
- mstar.model.omnivoice.components.codec.post_process(waveform, config, ref_rms, pad_duration, fade_duration, enabled)[source]#
Silence trim, level match, fade and pad — the reference’s tail.
Level handling differs by mode and is not cosmetic: a cloned voice is matched to the reference’s RMS (quiet references stay quiet), while a designed or automatic voice has no reference to match and is peak-normalised to 0.5 instead.
Imported from the
omnivoicepackage rather than re-ported: the silence trim is pydub-based and re-implementing it would drift from the reference for no gain.- Parameters:
waveform (ndarray)
config (OmniVoiceConfig)
ref_rms (float | None)
pad_duration (float)
fade_duration (float)
enabled (bool)
- Return type:
ndarray