Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🇮🇳 Indian Language Voice Translator

A comprehensive and powerful application that provides seamless voice and audio translation into various major Indian languages.

This project offers two different interfaces to suit your needs:

  1. Modern Web Application (main.py): A sleek, high-aesthetic Glassmorphism-styled web application powered by FastAPI. It runs locally in your browser and accesses your microphone natively!
  2. Desktop GUI Application (app.py): A native Python desktop application built with Tkinter for a traditional windowed experience.

Both applications use speech_recognition via Google APIs for robust Speech-to-Text (STT), deep-translator for accurate text translation, and gTTS for natural Text-to-Speech (TTS) synthesis.


🛠 Prerequisites

Before starting, make sure you have the following installed on your system:

  • Python 3.10+: Make sure Python is installed and added to your system PATH.
  • uv (Recommended): An extremely fast Python package and environment manager. A standard pip setup can also be used.
  • FFmpeg (Optional but highly recommended): Required by pydub to process non-WAV media uploads (like .mp3 or .webm from browsers and phones).
    • Windows: Download from the official website and add it to your PATH variables.
    • Mac: brew install ffmpeg
    • Linux: sudo apt install ffmpeg

🚀 Setup & Installation

Follow these steps to get the app running:

Step 1: Clone the Repository

Open a terminal (Command Prompt, PowerShell, or bash) and run: bash git clone cd indian-language-translator

Step 2: Install Dependencies

This project uses uv for lightning-fast package management to ensure you don't run into dependency issues. To sync and install all required packages listed in pyproject.toml and uv.lock, simply run:

bash uv sync

(If you don't use uv, you can manually spawn a virtual environment and run pip install -r requirements.txt or install the packages defined in the pyproject.toml file).


💻 Usage Instructions

Option A: Running the Modern Web Interface (Highly Recommended)

This launches a beautiful, browser-based user interface with animated glassmorphism design.

  1. Start the Backend Server: From your project directory, launch FastAPI using uv: bash uv run python main.py

    You should see a message indicating the server is running on http://127.0.0.1:8000.

  2. Open the Application: Open your preferred web browser and go to: http://127.0.0.1:8000

  3. How to Use the Web App:

    • Language Configuration: Select your spoken language (Source) and the Indian language you want to translate to (Target) from the dropdown menus.
    • Upload Audio File: Click Upload Audio to choose an audio file from your computer. (Accepts .wav, and other formats if FFmpeg is installed).
    • Record directly: Click and hold 🎙️ Record from Mic to speak directly into your computer's microphone. Your browser will prompt you for microphone permissions the first time.
    • Listen & Read: The app will display your transcribed input text, the translated text, and an audio player will dynamically load at the bottom so you can listen to the resulting translation!

Option B: Running the Native Desktop Interface

This launches a native OS window with traditional UI elements.

  1. Start the Desktop App: From your terminal, execute the following command: bash uv run python app.py

    A traditional software window titled "Indian Language Voice Translator" will appear.

  2. How to Use the Desktop App:

    • Use the dropdowns at the top to select your Input Language and Output Language.
    • Click 📁 Upload Audio File to browse your PC for an audio file to translate.
    • Click 🎙️ Record from Mic to capture live voice using your desktop microphone. Ensure you wait for the console prompt saying "Listening..." before you speak.
    • Wait for the processing to finish. The app explicitly updates its status letting you know what it is doing (transcribing, translating, etc.).
    • The original text, translated text will populate the text boxes, and the resulting speech output will automatically play on your system media player!

🏗 Architecture Details

  • main.py: The FastAPI server. It exposes a single endpoint /api/process that accepts audio blobs, uses speech_recognition to resolve STT, processes it with GoogleTranslator, builds an MP3 buffer via gTTS, and returns it as a Base64 string for immediate in-browser playback. It also serves the frontend.
  • app.py: The Tkinter GUI desktop version. Everything runs synchronously within thread wrappers, using your default OS handlers to manage outputs.
  • static/index.html: The entire frontend interface for the web app uses pure Vanilla JS without any bulky node dependencies.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages