Files
candle/candle-examples/examples/encodec
Joel Nises 6e6c1c99b0 Fix issues in the encodec example README.md (#2407)
Also squeeze the first dimension of the codes tensor in the example file to get the expected three dimensions.
2024-08-10 07:49:05 +02:00
..

candle-endocec

EnCodec is a high-quality audio compression model using an encoder/decoder architecture with residual vector quantization.

Running one example

cargo run --example encodec --features encodec --release -- code-to-audio \
    candle-examples/examples/encodec/jfk-codes.safetensors \
    jfk.wav

This decodes the EnCodec tokens stored in jfk-codes.safetensors and generates an output wav file containing the audio data.

Instead of code-to-audio one can use:

  • audio-to-audio in.mp3 out.wav: encodes the input audio file then decodes it to a wav file.
  • audio-to-code in.mp3 out.safetensors: generates a safetensors file containing EnCodec tokens for the input audio file.

If the audio output file name is set to -, the audio content directly gets played on default audio output device. If the audio input file is set to -, the audio gets recorded from the default audio input.