Skip to content

JargeZ/SonioxSRT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SonioxSRT

SonioxSRT provides helper libraries and CLIs for working with the Soniox async transcription API and generating SRT subtitles. The repository hosts parallel implementations in Python and TypeScript that share common samples and tests.

Repository Layout

  • python/ – Python package, CLI entry points, and pytest suite.
  • ts/ – TypeScript port with equivalent APIs, CLIs, and Vitest coverage.
  • samples/ – Shared audio/transcript fixtures used by both stacks.

Quick Start

  1. Export your Soniox API key (or add it to a .env file in the repo root):
    export SONIOX_API_KEY=<YOUR_API_KEY>
  2. Pick the language you want to use:

Both implementations load the shared fixtures from samples/ and expose CLIs for transcribing audio and emitting SRT files.

Basic Usage

Python

from pathlib import Path
from sonioxsrt import srt, run_realtime_session

# Convert the shared sample transcript into subtitles
srt(Path("../samples/response.json"), output_path="subtitles.srt")
print("SRT ready at subtitles.srt")

# Stream audio using the realtime model (requires `pip install websockets`)
session = run_realtime_session("../samples/audio.mp3", model="stt-rt-preview-v2")
print(session.text)

TypeScript

import { srt, runRealtimeSession } from "sonioxsrt";

// Convert the shared sample transcript into subtitles
srt("../samples/response.json", "subtitles.srt");
console.log("SRT ready at subtitles.srt");

// Realtime transcription (requires the optional `ws` dependency)
const session = await runRealtimeSession({
  audioPath: "../samples/audio.mp3",
  model: "stt-rt-preview-v2"
});
console.log(session.text);

Testing Locally

  • Python

    cd python
    poetry install
    poetry run pytest
  • TypeScript

    cd ts
    npm install
    npm test

Continuous Integration

GitHub Actions runs both the Python and TypeScript suites on every push and pull request. The workflow definition lives at ./.github/workflows/tests.yml.

About

SonioxSRT provides helper libraries and CLIs for working with the Soniox async transcription and translation API and generating SRT subtitles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 64.4%
  • TypeScript 35.4%
  • JavaScript 0.2%