Skip to content

maojcn/SimultaneousInterpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Whisper Voice Interpreter

A real-time speech recognition and translation tool using OpenAI's Whisper model.

Overview

This application captures audio from your microphone, transcribes it using OpenAI's Whisper speech recognition model, and translates the text to your desired language using Google Translate. It works in chunks of 5 seconds, providing near real-time interpretation.

Features

  • Real-time speech recognition using OpenAI's Whisper model
  • Translation between numerous languages using Google Translate
  • Configurable source and target languages
  • Multiple Whisper model sizes to balance accuracy and performance

Requirements

  • Python 3.7+
  • PyTorch
  • OpenAI Whisper
  • PyAudio
  • googletrans

Installation

# Install dependencies
pip install torch whisper pyaudio googletrans==4.0.0-rc1 wave

Usage

Run the interpreter with default settings (English to Spanish):

python simultaneous-interpreter.py

Customize languages and model size:

python simultaneous-interpreter.py --source en --target fr --whisper medium

Command Line Arguments

  • --source, -s: Source language code (default: en)
  • --target, -t: Target language code (default: es)
  • --whisper, -w: Whisper model size (choices: tiny, base, small, medium, large, default: base)

How It Works

  1. The application initializes the Whisper model and Google Translator
  2. It records audio in 5-second chunks
  3. Each chunk is transcribed using Whisper
  4. The transcribed text is translated to the target language
  5. Both original and translated text are displayed in the console
  6. Press Ctrl+C to stop the interpreter

Supported Languages

The application supports all languages available in both Whisper and Google Translate, including English, Spanish, French, German, Chinese, and many more.

Language Codes

The application uses ISO 639-1 language codes for translation. Some language codes include country codes (e.g., zh-CN or zh-TW).

Supported languages include:

  • af: Afrikaans
  • ar: Arabic
  • bg: Bulgarian
  • bn: Bengali
  • ca: Catalan
  • cs: Czech
  • da: Danish
  • de: German
  • el: Greek
  • en: English
  • es: Spanish
  • et: Estonian
  • fa: Persian
  • fi: Finnish
  • fr: French
  • he: Hebrew
  • hi: Hindi
  • hr: Croatian
  • hu: Hungarian
  • id: Indonesian
  • it: Italian
  • ja: Japanese
  • ko: Korean
  • lt: Lithuanian
  • lv: Latvian
  • ms: Malay
  • nl: Dutch
  • no: Norwegian
  • pl: Polish
  • pt: Portuguese
  • ro: Romanian
  • ru: Russian
  • sk: Slovak
  • sl: Slovenian
  • sv: Swedish
  • th: Thai
  • tr: Turkish
  • uk: Ukrainian
  • ur: Urdu
  • vi: Vietnamese
  • zh-cn: Chinese (Simplified)
  • zh-tw: Chinese (Traditional)

And many more supported by the googletrans library.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages