Skip to content

Latest commit

 

History

History
55 lines (38 loc) · 1.85 KB

README.md

File metadata and controls

55 lines (38 loc) · 1.85 KB

Audio Codecs

A collection of audio codecs with a standardized API. The following codecs are currently supported:


🛠️️ Installation

From source

First of all, install Python 3.8 or later. Clone or download and extract the repository, navigate to <path-to-repository>, open a terminal and run:

# Install the package locally in editable mode
pip install -e .[all]

▶️ Quickstart

To use one of the available codecs in your script:

import torch
import torchaudio
from audiocodecs import Encodec

sig, sample_rate = torchaudio.load("<path-to-audio-file>")
model = Encodec(sample_rate=sample_rate, orig_sample_rate=24000, num_codebooks=8)
with torch.no_grad():
    toks = model.sig_to_toks(sig)
    rec_sig = model.toks_to_sig(toks)
torchaudio.save("reconstruction.wav", rec_sig, sample_rate)

Reference implementations of downstream tasks using audio codecs can be found in benchmarks.


📧 Contact

luca.dellalib@gmail.com