Skip to main content

swanada (स्वनद)

In-browser, Node.js, and Python 16,000 Hz multilingual speech-to-text (STT) for Classical Sanskrit (sa), Indian English (en), and ten Indic languages (hi, kn, mr, bn, ta, te, ml, gu, pa, or) powered by 17-layer Conformer-CTC INT8 models running 100% client-side via ONNX/WASM with zero cloud or server dependencies.

npm install swanada
pip install swanada

Quick Start (JavaScript / TypeScript)

import { Swanada } from 'swanada';

// Initialize transcriber for Classical Sanskrit
const transcriber = await Swanada.create({
  language: 'sa',
  executionProvider: 'wasm',
  numThreads: 4,
});

// Transcribe audio Float32Array PCM or WAV ArrayBuffer
const result = await transcriber.transcribe(audioPcmFloat32);
console.log(`Transcript (${result.language}):`, result.text);
console.log(`Duration: ${result.durationMs}ms | Latency: ${result.inferenceMs}ms | RTF: ${result.rtf}`);

// Classical Sanskrit to Roman IAST transliteration
const iast = Swanada.transliterateIast(result.text);
console.log('IAST Transliteration:', iast);

await transcriber.release();

Quick Start (Python)

from swanada import Swanada

stt = Swanada.create(language="kn")  # Kannada
result = stt.transcribe("speech_16k.wav")

print("Transcript:", result.text)
print(f"Duration: {result.duration_ms:.1f}ms | Latency: {result.inference_ms:.1f}ms | RTF: {result.rtf:.3f}")

CLI Usage

Dual-runtime command-line interface with identical flags:

# Node.js CLI
npx swanada speech.wav -l sa
npx swanada recitation.wav -l sa --json -o output.json
cat stream.wav | npx swanada -l hi --stream

# Python CLI
swanada speech.wav -l kn
cat stream.wav | swanada -l ta --stream

Unified CLI Flags

  • -l, --language <lang>: Language code (default: sa). Supported: sa, en, hi, kn, mr, bn, ta, te, ml, gu, pa, or.
  • -m, --model-dir <dir>: Optional custom models directory.
  • -o, --output <file>: Output text file (default: stdout).
  • --json: Emit structured JSON with text, durationMs, inferenceMs, rtf, and tokens.
  • --stream: Simulate chunk-by-chunk streaming transcription (320 ms quanta).
  • --iast: Transliterate Classical Sanskrit output to Roman IAST with Vedic accents.
  • -h, --help: Show help and usage summary.
  • -v, --version: Show version (swanada 1.0.0).

Benchmarks

Evaluated across 480 held-out 16 kHz utterances (40 per language, B = 1,000 bootstrap 95% CIs), 1,200 unseen google/fleurs + wild test clips, and 72 streaming sessions (100 ms chunks):

Language Code Held-Out CER (95% CI) Held-Out WER Unseen Fleurs CER
Classical Sanskrit sa 5.24% [3.47%, 7.28%] 27.77% 17.10%
Indian English en 5.70% [4.41%, 7.00%] 16.94% 15.61%
Hindi hi 3.44% [2.34%, 4.53%] 12.64% 5.52%
Kannada kn 6.03% [4.65%, 7.58%] 35.70% 5.11%
Marathi mr 7.31% [4.30%, 10.50%] 27.52% 7.37%
Bengali bn 7.76% [6.07%, 9.54%] 40.66% 5.71%
Tamil ta 8.01% [6.28%, 9.86%] 38.46% 10.88%
Telugu te 5.54% [4.01%, 7.16%] 30.62% 9.05%
Malayalam ml 7.78% [5.58%, 10.13%] 40.27% 6.42%
Gujarati gu 5.32% [3.42%, 7.73%] 23.17% 6.69%
Punjabi pa 7.71% [4.69%, 11.34%] 29.47% 9.59%
Odia or 8.94% [6.25%, 12.46%] 37.55% 8.95%
Overall (12 Langs) — 6.57% [5.94%, 7.22%] 30.06% 9.00%

Shared 178 MB INT8 Conformer encoder + 515 KB per-language CTC projection heads run at 0.0325x CPU RTF, ~8-11 ms streaming chunk latency, and 0.00% committed prefix churn.

Live Playground

Model Weights & Hugging Face Hub

Quantized INT8 model weights are hosted on Hugging Face Hub:

License

MIT © Hemanth HM

Metadata

Release files for swanada 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swanada 1.0.0
File Size Uploaded Provenance Actions
swanada-1.0.0.tar.gz 166.2 kB Without provenance Details for swanada-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swanada 1.0.0
File Interpreter ABI Platform Actions
swanada-1.0.0-py3-none-any.whl Python 3 none any Details for swanada-1.0.0-py3-none-any.whl

Total release size: 254.7 kB

Release files / swanada-1.0.0.tar.gz

Download URL swanada-1.0.0.tar.gz
Size 166.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1498a7f1eb55b826a1a846e48f2c32d01ce98a5e10525efdba721af834fddd18
BLAKE2b-256 checksum
How to use checksums
e2702817d994b356a7827541388d604fa5a64ebf6e4ccfdd02220beea9458f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / swanada-1.0.0-py3-none-any.whl

Download URL swanada-1.0.0-py3-none-any.whl
Size 88.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfee653a1f3969952028e1d5cf360e218486426793281a3bc3644478c6d1a6d0
BLAKE2b-256 checksum
How to use checksums
accb2f629783ccc62300c223667ee2b9635ea55288da5290d7fcb1e27297bfff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for swanada 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page