Skip to main content

audio diarizer and automatic speech recognition cli tool

Project description

transaud Description

A command-line tool for speaker-attributed transcription using pyannote for speaker diarization and Whisper Turbo for speech-to-text. The tool produces readable, timestamped transcripts with speaker labels.

Overview

This tool performs the following steps:

  1. Converts the input audio file to a temporary WAV format.
  2. Runs speaker diarization to detect speaker turns.
  3. Transcribes each speaker’s audio segment using Whisper Turbo.
  4. Writes a formatted transcript grouped by speaker and timestamp. GPU acceleration is automatically enabled when available, with a CPU fallback.

Usage

poetry run transcribe -iaf /path/to/audio/file.ext

Optional arguments

  • --num-speakers: Specify the number of speakers if known (improves diarization).
  • --line-length: Set maximum line width for wrapped transcript text.
  • --output-text-file: Specify a custom output file path.

Output

The generated transcript:

  • Groups consecutive speech from the same speaker
  • Includes timestamps
  • Uses hanging indentation for readability If no output file is specified, a .txt file is created using the input audio filename.

Dependencies

  • torch
  • transformers
  • pyannote.audio (for diarization output)
  • tqdm
  • ffmpeg (system dependency)

Environment variables.

Hugging Face Authentication (Required)
This project uses pretrained models hosted on Hugging Face.

  1. Generate a new huggingface token if you don't have one from hf tokens.
  2. Approve access to the pyannote diarization model - link
  3. Create a .env file in the project root
    HF_TOKEN=your_token_here
    
  4. Ensure environment variables are loaded into your shell:
    export HF_TOKEN=your_token_here
    

Security Notice

[!Caution] This module loads pretrained models from trusted Hugging Face repositories. Ensure model sources are trusted when running in production environments.

Known Issues

Apple Silicon (macOS)

On Apple Silicon machines, you may encounter issues related to torchcodec or audio decoding. If so, update your ffmpeg library path:

export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"

Notes

  • Converting audio to WAV internally ensures consistent behavior across systems.
  • For best results, provide --num-speakers when the number of speakers is known.
  • Long recordings may require significant memory when running on CPU.

Model Licenses

This package does not ship any pretrained models. Models are downloaded at runtime from Hugging Face and are subject to their respective licenses:

  • Whisper Turbo: OpenAI license
  • pyannote speaker diarization: pyannote community license Users are responsible for reviewing and complying with these licenses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transaud-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transaud-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file transaud-0.1.0.tar.gz.

File metadata

  • Download URL: transaud-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.7 Darwin/23.0.0

File hashes

Hashes for transaud-0.1.0.tar.gz
Algorithm Hash digest
SHA256 394c21cb67fd99cb97859da8938b451235d2e1bbd0c3be4f7179d6ec3872f1e1
MD5 c1b716453f474a747583073e75747ee3
BLAKE2b-256 9178252ca0b36c8c8f11ebe8baa6fcc09a6ea237ffc4b56ead29ffd45d167afb

See more details on using hashes here.

File details

Details for the file transaud-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: transaud-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.7 Darwin/23.0.0

File hashes

Hashes for transaud-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 961a365dd1040b2e234cec884c1f9021bdfc17cf9e7547d6ca617b3023bcc549
MD5 3412c3f10fac700afb275beb6414362a
BLAKE2b-256 9e759797a43410ae69948ab94fedae029fe341d4e56858a958d47d8c7063d295

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page