File size: 832 Bytes
7145cb7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
---
license: mit
tags:
- mlx
---
### Descript Audio Codec — MLX
This model is reshaped for MLX from the original weights and is designed for use with [descript-mlx](https://github.com/lucasnewman/descript-mlx)
## Installation
```bash
pip install descript-mlx
```
## Usage
You can load a pretrained model from Python like this:
```python
import mlx.core as mx
from descript_mlx import DAC
dac = DAC.from_pretrained("16khz")
audio = mx.array(...)
# encode into latents and codes
z, codes, latents, commitment_loss, codebook_loss = dac.encode(audio)
# reconstruct from latents/codes to audio
reconstucted_audio = dac.decode(z)
# compress audio to a DAC file
dac_file = dac.compress(audio)
dac_file.save("/path/to/file.dac")
# decompress audio from a DAC file
reconstructed_audio = dac.decompress("/path/to/file.dac")
``` |