Views
No views yet
| Sample rate | 16 kHz mono |
| Bitrate | ~6 kbps (9 RVQ codebooks × 1024 entries) |
| Frame size | 15 ms (hop = 240 samples) |
| Latency | ~30 ms algorithmic (2 future frames) |
| Parameters | 17.8 M |
| Best val STOI | 0.94 |
1git clone https://huggingface.co/Lucabr01/Zero-Ping
2cd Zero-Ping
3pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
4pip install vector-quantize-pytorch einops huggingface_hub
5pip install -e .1import torch, torchaudio
2from zpcodec import ZPCodec, GilbertElliottConfig, GilbertElliottSimulator
3
4# Load model (downloads weights automatically on first run)
5model = ZPCodec.from_pretrained("Lucabr01/Zero-Ping", device="cpu")
6
7# Load audio (must be 16 kHz mono)
8wav, sr = torchaudio.load("speech.wav")
9if sr != 16000:
10 wav = torchaudio.functional.resample(wav, sr, 16000)
11wav = wav.mean(0, keepdim=True).unsqueeze(0) # [1, 1, T]
12
13with torch.no_grad():
14 # Encode → decode (clean, no packet loss)
15 z_q, indices = model.encode(wav)
16 wav_clean = model.decode(z_q)
17
18 # Simulate 10% packet loss and repair
19 cfg = GilbertElliottConfig(p=0.05, r=0.5, k=0.999, h=0.5)
20 sim = GilbertElliottSimulator(cfg, sample_rate=16000, hop_length=model.hop_length)
21 mask = sim.sample_frame_mask(1, z_q.shape[-1])
22 wav_repaired = model.decode(z_q, frame_mask=mask)
23
24torchaudio.save("clean.wav", wav_clean.squeeze(0), 16000)
25torchaudio.save("repaired.wav", wav_repaired.squeeze(0), 16000)GilbertElliottConfig parameters let you tune the simulated channel:p — probability of entering the Bad state (higher = more frequent bursts)r — probability of leaving the Bad state (higher = shorter bursts)h — P(no loss | Bad state), default 0.5@misc{zeropingcodec2026,
author = {Lucabr01},
title = {Zero-Ping: Neural Speech Codec with Packet-Loss Repair},
year = {2026},
url = {https://huggingface.co/Lucabr01/Zero-Ping}
}