Skip to content

vllm_omni.model_executor.common.audio.pcm

Little-endian float32 PCM (pcm_f32le) helpers.

Plain audio plumbing every model that takes raw PCM needs: decode a base64 chunk, check it is whole finite samples, count and materialise them. No duplex vocabulary lives here.

PCM_F32LE_BYTES_PER_SAMPLE module-attribute

PCM_F32LE_BYTES_PER_SAMPLE = 4

decode_pcm_f32le_base64

decode_pcm_f32le_base64(
    encoded: object, *, model: str = "audio"
) -> bytes

Decode base64 pcm_f32le into raw bytes, refusing partial or non-finite samples.

model names the caller in error messages so a client sees which model rejected its audio.

pcm_f32le_sample_count

pcm_f32le_sample_count(raw: bytes) -> int

pcm_f32le_samples

pcm_f32le_samples(raw: bytes) -> ndarray

The samples as a writable, contiguous float32 array (safe for zero-copy tensor views).