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 4.27% [2.69%, 6.10%] 22.99% 17.10%
Indian English en 6.23% [4.67%, 7.92%] 17.07% 15.61%
Hindi hi 2.20% [1.45%, 3.03%] 8.18% 5.52%
Kannada kn 5.21% [3.88%, 6.88%] 31.67% 5.11%
Marathi mr 5.72% [3.19%, 8.34%] 22.52% 7.37%
Bengali bn 5.95% [4.37%, 7.59%] 31.14% 5.71%
Tamil ta 7.56% [6.01%, 9.11%] 38.24% 10.88%
Telugu te 4.95% [3.62%, 6.49%] 29.83% 9.05%
Malayalam ml 6.16% [4.10%, 8.27%] 34.03% 6.42%
Gujarati gu 4.79% [2.97%, 6.98%] 19.28% 6.69%
Punjabi pa 6.35% [3.52%, 9.78%] 23.38% 9.59%
Odia or 6.93% [4.91%, 9.41%] 35.50% 8.95%
Overall (12 Langs) — 5.53% [4.94%, 6.11%] 26.15% 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.1

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.1
File Size Uploaded Provenance Actions
swanada-1.0.1.tar.gz 409.0 kB Without provenance Details for swanada-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 737.1 kB

Release files / swanada-1.0.1.tar.gz

Download URL swanada-1.0.1.tar.gz
Size 409.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7888fc4bdada23bfb9b819f886f4d650a1ad87f50fc5e8f9a782045649b3df1e
BLAKE2b-256 checksum
How to use checksums
efd612547389690e5454103e14106975d55bb5fb3219eec36b1345b4eb6da374
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.1-py3-none-any.whl

Download URL swanada-1.0.1-py3-none-any.whl
Size 328.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9ebfff8ce32ba11e7af295d0609f32670010219845c3b18c2f9397a059c480e
BLAKE2b-256 checksum
How to use checksums
10f50129971aafacddc98d4d150343f3cf8d598c3d59a67c909b1ce46685888e
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.1

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