Metadata-Version: 2.4
Name: voxrt-asr
Version: 0.1.2
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Rust
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
License-File: LICENSE
License-File: LICENSE-BINARY
Summary: On-device streaming speech recognition for Linux x86_64 + aarch64 — servers, containers, Pi 4/5, Jetson, Graviton
Keywords: asr,speech-recognition,speech-to-text,stt,streaming,voice,voice-assistant,raspberry-pi,jetson,graviton,edge,on-device,embedded,server,cloud,self-hosted,voxrt
Author-email: VoxRT authors <help@voxrt.com>
License-Expression: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://github.com/VoxRT/voxrt-asr-linux#readme
Project-URL: Homepage, https://voxrt.com
Project-URL: Issues, https://github.com/VoxRT/voxrt-asr-linux/issues
Project-URL: Repository, https://github.com/VoxRT/voxrt-asr-linux

# voxrt-asr

**Streaming speech recognition for Linux x86_64 + aarch64.** Custom Rust inference runtime, NeMo FastConformer (32 M parameters), 16 kHz mono PCM in, incremental UTF-8 text out. Cache-aware streaming with ~1.1 s emit cadence.

Runs on modern x86_64 servers (Haswell 2013+, Excavator 2015+) and aarch64 edge devices (Pi 4/5, Jetson, Graviton, industrial SBCs) on a **glibc 2.17+** baseline. Measured **streaming RTF ≈ 0.06-0.08** on an Intel WSL2 host (500-utterance LibriSpeech test-clean subset).

Companion to [`voxrt-asr-android`](https://github.com/VoxRT/voxrt-asr-android) (JitPack AAR) and [`voxrt-asr-ios`](https://github.com/VoxRT/voxrt-asr-ios) (Swift Package Manager). Same runtime, same `.vxrt` model, same decoder schema.

## Install

```sh
pip install voxrt-asr
```

One `abi3` wheel covers Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 per arch.

Get the streaming ASR model:

```sh
curl -LO https://github.com/VoxRT/voxrt-asr-models/releases/download/v0.1.2/streaming_medium_pc.vxrt
```

SHA-256: `<see-linked-repo>`

## Quick start — streaming

```python
from voxrt_asr import AsrStreamingEngine, DecodeMode

# RNN-T is the SDK-wide recommended default (higher accuracy).
# Pass DecodeMode.CTC for the ~15 % cheaper head at ~1.6 pp higher WER.
engine = AsrStreamingEngine.from_path(
    "streaming_medium_pc.vxrt",
    mode=DecodeMode.RNNT,
)

for chunk in microphone_iter():        # list[float], 16 kHz mono, any length
    text = engine.push_audio(chunk)
    if text:
        print(text, end="", flush=True)

final = engine.stop()
if final:
    print(final)
```

Each `push_audio` returns the **incremental** text emitted by chunks
that completed during that call — often `""` until ~1.12 s of audio
has accumulated, then a non-empty string every chunk boundary
(~1.12 s emit cadence, matching the streaming model's cache-aware
step). Concatenate the returned strings yourself if you need the full
utterance transcript.

## Batch / whole-file transcription

The Linux SDK is **streaming-only**. To transcribe a pre-recorded file
in one shot (SRT / JSON export from a folder of WAVs, dataset
labelling, container transcription workers), push the whole buffer
through the streaming engine and flush with `stop()`:

```python
from voxrt_asr import AsrStreamingEngine, DecodeMode

engine = AsrStreamingEngine.from_path("streaming_medium_pc.vxrt")
parts = [engine.push_audio(pcm_float32_list)]   # whole file at once
parts.append(engine.stop())
transcript = "".join(parts)
```

Reuse one engine across files — call `reset()` between them to clear
per-utterance state without reloading the weights.

## Audio contract

- **Sample rate:** 16 000 Hz. **No automatic resampling.** Convert
  from 44.1 / 48 kHz via `soundfile.resample`, `librosa.resample`,
  `torchaudio.resample`, or an `sox` / `ffmpeg` upstream stage.
- **Sample format:** `list[float]` PCM in `[-1, 1]` (mono, native
  endian). If you have `int16` samples from `pyaudio` /
  `sounddevice` / `wave.readframes`, divide by 32768.0 first.
- **Buffer size:** any. The session buffers internally to its
  ~17 920-sample chunk boundary and emits text there.
- **Latency:** one chunk (~1.12 s) of inherent buffering.

## Threading

The engine is a **synchronous, stateful function** — it does NOT own
a worker thread. Each `push_audio` blocks on the calling thread for
the duration of the inference work. Serialise `push_audio` / `stop` /
`reset` against each other on a given instance (single-thread-at-a-time
per handle). For multi-tenant serving, create one engine per stream —
they don't share state and the ~150 MB heap is per-session.

## License

- Wrapper (this Python package): [Apache-2.0](LICENSE).
- Compiled runtime `.so` bundled inside the wheel: proprietary VoxRT
  Binary Use License, see [LICENSE-BINARY](LICENSE-BINARY).
- Streaming ASR model weights: derived from
  [`nvidia/stt_en_fastconformer_hybrid_medium_streaming_80ms_pc`](https://huggingface.co/nvidia/stt_en_fastconformer_hybrid_medium_streaming_80ms_pc),
  **CC-BY-4.0**.

Commercial licensing for custom models, additional languages,
on-premise fine-tuning, or bulk-device deployments: help@voxrt.com.

## Links

- Umbrella README + full SDK docs: <https://github.com/VoxRT/voxrt-asr-linux>
- ASR model releases: <https://github.com/VoxRT/voxrt-asr-models>
- Android: <https://github.com/VoxRT/voxrt-asr-android>
- iOS: <https://github.com/VoxRT/voxrt-asr-ios>
- Bugs / questions: <https://github.com/VoxRT/voxrt-asr-linux/issues>

