Skip to main content

AudioTokenizer

Trait AudioTokenizer 

Source
pub trait AudioTokenizer {
    type Tensor: Tensor;

    // Required methods
    fn config(&self) -> AudioTokenizerConfig;
    fn encode(
        &mut self,
        pcm: &Self::Tensor,
        context: &<Self::Tensor as Tensor>::Context,
    ) -> Result<Self::Tensor, Error>;
    fn decode(
        &mut self,
        codes: &Self::Tensor,
        context: &<Self::Tensor as Tensor>::Context,
    ) -> Result<Self::Tensor, Error>;
}
Expand description

Common interface for neural audio tokenizers.

Required Associated Types§

Source

type Tensor: Tensor

Backend-native tensor handle.

Required Methods§

Source

fn config(&self) -> AudioTokenizerConfig

Codec configuration.

Source

fn encode( &mut self, pcm: &Self::Tensor, context: &<Self::Tensor as Tensor>::Context, ) -> Result<Self::Tensor, Error>

Encodes mono PCM shaped [batch, channels, samples] into codec tokens.

Source

fn decode( &mut self, codes: &Self::Tensor, context: &<Self::Tensor as Tensor>::Context, ) -> Result<Self::Tensor, Error>

Decodes codec tokens shaped [batch, codebooks, frames] into PCM.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§