Convert audio recordings to text using faster-whisper with ModelScope
Project description
TingXie
Convert audio recordings to text using faster-whisper with ModelScope model downloads. No HuggingFace needed — models are fetched from ModelScope's China-based CDN.
What It Does
TingXie transcribes .wav, .mp3, .m4a, .flac, .ogg, .wma, .aac, .opus, and .webm files to text. It can process a single file or batch-transcribe an entire directory. Each file gets detected language, per-segment timestamps, and a plain-text transcript.
Models download automatically from ModelScope (iic/speech_whisper_* repos), not HuggingFace. Set TINGXIE_MODEL_DIR to override the cache directory (default: ~/.cache/tingxie/models).
What it does not do: streaming transcription, real-time microphone input, speaker diarization, or translation (transcription only).
Features
- Single file or batch directory transcription
- faster-whisper: 4x faster than openai-whisper, lower memory usage
- ModelScope model downloads (no HuggingFace, no wall issues in China)
- 15+ Whisper model variants:
tiny,base,small,medium,large-v3,turbo,distil-* - CPU and CUDA inference with configurable compute type
- Automatic language detection or manual language hint
- Per-segment timestamps with verbose mode
- JSON output for pipeline integration
- OpenAI function-calling tools schema for agent integration
Requirements
- Python >= 3.9
- faster-whisper (installed automatically)
- modelscope (installed automatically)
- CTranslate2 (installed with faster-whisper)
- FFmpeg (required by faster-whisper —
brew install ffmpegon macOS)
Installation
pip install -e .
For development dependencies:
pip install -e ".[dev]"
Quick Start
Transcribe a single file:
tingxie samples/20260610_125906.wav
Batch transcribe a directory:
tingxie samples/ -m base -l zh
Save transcripts to files:
tingxie samples/ -o output/
Force CPU inference:
tingxie recording.wav --device cpu
CLI Usage
tingxie [-V] [-v] [-q] [--json] [-m MODEL] [-l LANG] [-o PATH]
[--device {auto,cpu,cuda}] [--compute-type TYPE] PATH
| Flag | Meaning |
|---|---|
-V, --version |
Print version and exit |
-v, --verbose |
Show per-segment timestamps |
-q, --quiet |
Suppress non-essential output |
--json |
Output as JSON |
-m, --model |
Whisper model (default: turbo) |
-l, --language |
Language hint, e.g. zh, en |
-o, --output |
Output file or directory |
--device |
Inference device: auto, cpu, cuda |
--compute-type |
Quantization: default, int8, float16, float32 |
Available Models
tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large-v1, large-v2, large-v3, large, distil-large-v2, distil-large-v3, distil-medium.en, distil-small.en, turbo
Python API
from tingxie import transcribe, transcribe_dir
# Single file
result = transcribe(audio_path="samples/20260610_125906.wav", model="turbo")
print(result.success) # True
print(result.data["text"]) # transcribed text
print(result.data["language"]) # detected language
# Force CPU with int8 quantization
result = transcribe(
audio_path="recording.wav",
device="cpu",
compute_type="int8",
)
# Directory batch
result = transcribe_dir(
directory="samples/",
model="turbo",
output="transcripts/",
)
for filename, info in result.data.items():
print(f"{filename}: {info['text'][:50]}...")
Agent Integration
from tingxie.tools import TOOLS, dispatch
# Use TOOLS in your OpenAI function-calling setup
# Then dispatch results:
result = dispatch("tingxie_transcribe", {
"audio_path": "recording.wav",
"model": "turbo",
"device": "cpu",
})
Model Cache
Models are stored at ~/.cache/tingxie/models/ by default. Override with:
export TINGXIE_MODEL_DIR=/custom/path
tingxie recording.wav
Limitations
- Requires FFmpeg installed on the system
- First run with a model downloads it from ModelScope (~1GB for
turbo) - Not suitable for real-time streaming
- No speaker diarization (cannot distinguish multiple speakers)
- GPU recommended for models larger than
small
Development
pip install -e ".[dev]"
ruff format . && ruff check . && mypy . && pytest
License
GPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tingxie-0.2.0.tar.gz.
File metadata
- Download URL: tingxie-0.2.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6a81ebb2876dcc0bad53c7f6d3f639525ba493d9cd21c67fc3b684d91820f7
|
|
| MD5 |
2337479d87f66381c208e43cc721e8b4
|
|
| BLAKE2b-256 |
1e159db11dd9d0f2c678805ec4efd9274b6736fd98f4f0a541b08d1c2bbd092c
|
File details
Details for the file tingxie-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tingxie-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cefad94a806e8ba31bfd3f1c69815ccb315547b1b33c5b46ca68c4299f2fc17
|
|
| MD5 |
aed3f10387e98b054c247684c2cb3f99
|
|
| BLAKE2b-256 |
2d81da3c570a5bcb304bbdfe90e7c6d224716f21ab1d66e297c157d572853d78
|