Upload Hcodec readme
Browse files
README.md
CHANGED
|
@@ -7,3 +7,87 @@ tags:
|
|
| 7 |
- music
|
| 8 |
- code
|
| 9 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
- music
|
| 8 |
- code
|
| 9 |
---
|
| 10 |
+
# QuarkAudio-HCodec: A Unified Discrete Audio Tokenizer for High-Fidelity, Multitask Audio Generation
|
| 11 |
+
|
| 12 |
+
<p align="center">
|
| 13 |
+
<a href="https://arxiv.org/abs/2510.26372">
|
| 14 |
+
<img src="https://img.shields.io/badge/Paper-ArXiv-red.svg" alt="Paper">
|
| 15 |
+
</a>
|
| 16 |
+
<a href="https://huggingface.co/spaces/QuarkAudio/">
|
| 17 |
+
<img src="https://img.shields.io/badge/Model-Hugging%20Face-yellow.svg" alt="Hugging Face">
|
| 18 |
+
</a>
|
| 19 |
+
</p>
|
| 20 |
+
|
| 21 |
+
<p align="center">
|
| 22 |
+
<a href="https://arxiv.org/abs/2510.26372"><img src="HCodec.jpg" width="70%" /></a>
|
| 23 |
+
</p>
|
| 24 |
+
|
| 25 |
+
> π **H-Codec**: *A Unified, Dual-Stream Neural Audio Codec with Adaptive Frame Rate and 48kHz Support*
|
| 26 |
+
> Enabling high-fidelity, efficient, and semantically rich audio tokenization for next-generation LLM-based audio generation.
|
| 27 |
+
|
| 28 |
+
π **Key Highlights**:
|
| 29 |
+
- β
**Dual-Stream Tokenization**: Separately quantizes acoustic and semantic features into independent codebooks β preserving both signal fidelity and linguistic content.
|
| 30 |
+
- π **Dynamic Frame Rate (H-Codec-1.5)**: Introduces an adaptive temporal resolution mechanism built upon H-Codec-1.0, enabling variable frame rates based on content complexity.
|
| 31 |
+
- βοΈ **Multi-Sampling Rate (H-Codec-2.0)**: Extends the sampling rate from **16kHz to 48kHz** under a fixed frame rate, significantly improving audio fidelity and high-frequency detail preservation.
|
| 32 |
+
- π **Unified Foundation**: Designed as a core component for multimodal LLMs, supporting diverse downstream tasks: TTS, VC, Editing, TTA, SE, and more.
|
| 33 |
+
|
| 34 |
+
π **Paper**: [arXiv:2510.26372](https://arxiv.org/abs/2510.26372) | π€ **Listen**: [Demo Page](https://hyyan2k.github.io/UniSE/) | π€ **Model**: [Hugging Face Spaces](https://huggingface.co/spaces/QuarkAudio/)
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## π¦ Overview
|
| 39 |
+
|
| 40 |
+
This project introduces **H-Codec**, a unified discrete audio tokenizer that integrates self-supervised learning (SSL) representations into the codec architecture to enable **dual-stream (acoustic + semantic) tokenization**. Unlike prior work that fuses modalities before quantization (e.g., X-Codec), H-Codec employs **separate codebooks** for acoustic and semantic streams, allowing independent optimization and better reconstruction quality.
|
| 41 |
+
|
| 42 |
+
We extend the original H-Codec (*aka* H-Codec-1.0) in *UniTok-Audio (Liu et al., 2025)* into two advanced variants:
|
| 43 |
+
|
| 44 |
+
| Version | Key Feature | Sampling Rate | Frame Rate |
|
| 45 |
+
|---------------|----------------------------------|---------------|----------------|
|
| 46 |
+
| **H-Codec-1.0** | Dual-stream quantization | 16 kHz | Fixed |
|
| 47 |
+
| **H-Codec-1.5** | Dynamic frame rate adaptation | 16 kHz | Adaptive |
|
| 48 |
+
| **H-Codec-2.0** | Full-bandwidth 48kHz support | 48 kHz | Fixed |
|
| 49 |
+
|
| 50 |
+
These improvements significantly enhance **audio fidelity**, **temporal efficiency**, and **applicability** across speech, music, and general audio.
|
| 51 |
+
|
| 52 |
+
π§ **Architecture Core Components**:
|
| 53 |
+
1. **Encoder**: Extracts continuous representations from waveform and SSL model (e.g., WavLM).
|
| 54 |
+
2. **Quantizer Module**: Two independent codebooks β one for acoustic details, one for semantic meaning.
|
| 55 |
+
3. **Decoder**: Reconstructs high-quality audio from discrete token sequences.
|
| 56 |
+
|
| 57 |
+
π‘ H-Codec is designed as a foundational module for **LLM-based audio generation**, seamlessly integrating with autoregressive language models for end-to-end training and inference.
|
| 58 |
+
|
| 59 |
+
<!-- ---
|
| 60 |
+
|
| 61 |
+
## π§° Installation
|
| 62 |
+
|
| 63 |
+
### Option 1: Using pip
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
pip install -r requirements.txt -->
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## π― Quick Start: Run Inference in 3 Minutes
|
| 72 |
+
|
| 73 |
+
### 1. Clone Repository
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
git clone https://github.com/alibaba/unified-audio.git
|
| 77 |
+
cd QuarkAudio-HCodec
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
### 2. Create a Conda environment and install dependencies
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
conda create -n unise python=3.10
|
| 84 |
+
conda activate unise
|
| 85 |
+
pip install -r requirements.txt
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## 3. Tokenizer
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
#!/bin/bash
|
| 92 |
+
python audio_tokenizer.py
|
| 93 |
+
```
|