Skip to main content

No project description provided

Project description

RapidSpeech Logo

English | 简体中文

Open in Colab

RapidSpeech.cpp 🎙️

Python-friendly local ASR and TTS, powered by a native C++ GGUF runtime.

RapidSpeech.cpp gives Python developers a simple API for local speech recognition, text-to-speech, VAD, speaker embedding, and voice cloning. Under the hood it uses a pure C/C++ engine, ggml backends, and a unified GGUF model format, so you get native performance without running a speech server.


Python In 60 Seconds

Install

pip install rapidspeech

GPU wheels:

pip install rapidspeech-metal   # macOS / Apple Silicon
pip install rapidspeech-cuda    # Linux / NVIDIA

Text to speech

python python-api-examples/tts/tts-offline.py \
  --model /path/to/omnivoice-f16.gguf \
  --text "Hello, welcome to RapidSpeech." \
  --output output.wav

Speech to text

python python-api-examples/asr/asr-offline.py \
  --model /path/to/funasr-nano-fp16.gguf \
  --audio /path/to/audio.wav

Python API

import rapidspeech

tts = rapidspeech.tts_synthesizer("/path/to/omnivoice-f16.gguf")
tts.set_params(instruct="male, young adult", language="English", seed=42)
pcm = tts.synthesize("Hello from a native speech engine.")
sample_rate = tts.get_sample_rate()
import rapidspeech

asr = rapidspeech.asr_offline("/path/to/funasr-nano-fp16.gguf")
sample_rate = asr.get_model_meta()["audio_sample_rate"]
pcm = ...  # 1-D float32 mono PCM at sample_rate
asr.push_audio(pcm)
asr.process()
print(asr.get_text())

Why RapidSpeech.cpp

  • Python API, native core: write Python, run a C++/ggml engine underneath.
  • One model format: ASR, TTS, VAD, and speaker models use GGUF.
  • NumPy in, NumPy out: ASR takes float32 PCM; TTS returns float32 PCM.
  • Local by default: no cloud API, no speech server, no Python model stack.
  • Edge-first backends: CPU, Metal, CUDA, Vulkan, CANN, OpenCL, and WebGPU.

Performance Snapshot

Test environment: Apple M1 Pro, funasr-nano-fp16.gguf, 15s audio.

Configuration RTF Wall Time Notes
CPU -t 4 0.465 12.4s CPU-only inference
GPU -t 4 0.170 5.2s Metal acceleration
GPU -t 4 Q4_K 0.756 - Quantized model: GPU dequant overhead
CPU -t 4 Q4_K 0.530 - Quantized model CPU inference, 596 MB (3.3x compression)

RTF is processing time divided by audio duration. Lower is faster; RTF < 1 is faster than real time.


Supported Today

Task Models Status
ASR SenseVoice-small, FunASR-nano Stable
VAD Silero VAD, FireRedVAD Stable
TTS OmniVoice, OpenVoice2, Kokoro Active
Speaker CAMPPlus Stable

In Progress

CosyVoice3, Qwen3-ASR, Qwen3-TTS.


Documentation


Native C++ CLI

Download Models

Models are available on:

Build from Source

git clone https://github.com/RapidAI/RapidSpeech.cpp
cd RapidSpeech.cpp
git submodule sync && git submodule update --init --recursive
cmake -B build
cmake --build build --config Release

Build artifacts are located in the build/ directory:

  • rs-asr-offline — Offline ASR command-line tool
  • rs-asr-vad-online — VAD-segmented quasi-streaming ASR command-line tool
  • rs-tts-offline — Offline TTS command-line tool
  • rs-quantize — Model quantization tool

Core Commands

Offline ASR

./build/rs-asr-offline \
  -m /path/to/funasr-nano-fp16.gguf \
  -w /path/to/audio.wav \
  -t 4 \
  --gpu true

VAD-segmented ASR

./build/rs-asr-offline \
  -m /path/to/funasr-nano-fp16.gguf \
  -v /path/to/silero_vad_v6.gguf \
  -w /path/to/audio.wav \
  -t 4 \
  --vad-threshold 0.5 \
  --silence-ms 600

Text to speech

./build/rs-tts-offline \
  -m /path/to/omnivoice-f16.gguf \
  -t "Hello, welcome to RapidSpeech!" \
  --instruct "male, young adult, moderate pitch" \
  --lang English \
  --n-steps 32 \
  -o output.wav

Quantization

./build/rs-quantize /path/to/input-f16.gguf /path/to/output-q4_k.gguf q4_k

Python

See Python examples for offline ASR, streaming ASR, offline TTS, streaming TTS, VAD, and voice cloning.


🤝 Contributing

If you are interested in the following areas, we welcome your PRs or participation in discussions:

  • Adapting more models to the framework.
  • Refining and optimizing the project architecture.
  • Improving inference performance.

Acknowledgements

  1. Fun-ASR
  2. llama.cpp
  3. ggml
  4. cppjieba — Chinese word segmentation
  5. WeText — text normalization (ITN/TN)
  6. miniaudio — single-file audio I/O

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rapidspeech_metal-1.2.0-cp313-cp313-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rapidspeech_metal-1.2.0-cp312-cp312-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rapidspeech_metal-1.2.0-cp311-cp311-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rapidspeech_metal-1.2.0-cp310-cp310-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rapidspeech_metal-1.2.0-cp39-cp39-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file rapidspeech_metal-1.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidspeech_metal-1.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31f3f5dc2ef598d62cc98ef7b56854466b4870e28a1dc049eedc8131648fe682
MD5 b312e9cff954526ad9fe64d0fb8011f1
BLAKE2b-256 6a540dfae5ca1b3139b1b704764125b6e13655cec9e3695128843bd446550396

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidspeech_metal-1.2.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: pypi_publish.yml on RapidAI/RapidSpeech.cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidspeech_metal-1.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidspeech_metal-1.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23450e9bc27da4d2cd23196744b03fcf64a9588904ae1b9bfb310e3fbaab0af0
MD5 854db956093f9892d6cebf8318d396d4
BLAKE2b-256 bfbc7df71d7ae7fe343d0fa626f8ec912135d80ca9f826a2ecc62d860332e2c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidspeech_metal-1.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: pypi_publish.yml on RapidAI/RapidSpeech.cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidspeech_metal-1.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidspeech_metal-1.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a73691c5e831d770a7785bf061594ac71e1d9c92b82b11e3d491016fc3941fed
MD5 dbbe683eb531c8e0b9eba554a4d43316
BLAKE2b-256 2f99bb419fd9ebaeeeb46ced5c892fc944795efd1caca801836ec90ef5e687e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidspeech_metal-1.2.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: pypi_publish.yml on RapidAI/RapidSpeech.cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidspeech_metal-1.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidspeech_metal-1.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73accdd5d94acd3807cbdf425585142b98e5716fb1741332918d96f525cd6a79
MD5 8605169c1612e8d200ebf42a7d581e05
BLAKE2b-256 7071c990469a6d54dcab2c9f5d8d21704bd75b4468bed882ba5b84c8c49f18d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidspeech_metal-1.2.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: pypi_publish.yml on RapidAI/RapidSpeech.cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidspeech_metal-1.2.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidspeech_metal-1.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c581ca2a5309ffd90e078aa6748d6fab9055b0cd7953b153fbb83ff711a78c66
MD5 8c3fef94c2e4ae95203fa10ae6fee808
BLAKE2b-256 94b56d0197b6249f57347e306a8c298baa59f1aa780dababa8e88ae2cd12b8de

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidspeech_metal-1.2.0-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: pypi_publish.yml on RapidAI/RapidSpeech.cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page