Giter Club home page Giter Club logo

speech-recognition-and-translation-with-python's Introduction

Speech Recognition and Translation with Python

This repository contains a Python script that demonstrates how to perform speech recognition and translation using the SpeechRecognition, googletrans, and gTTS libraries. The script utilizes FFmpeg and FFprobe for audio file manipulation.

Features:

  • Load an audio file in MP3 format.
  • Convert the audio file to WAV format using FFmpeg.
  • Recognize speech from the audio using the Google Speech Recognition API.
  • Translate the recognized text to a desired language using the Google Translate API.
  • Convert the translated text to speech using gTTS.
  • Save the translated speech as an output audio file in MP3 format.

Installation:

  1. Install FFmpeg and Fprobe:

    • Ensure you have Homebrew installed on your system. If not, install Homebrew by following the instructions at https://brew.sh/.
    • Open a terminal and run the following commands:
      brew install ffmpeg
      brew install fprobe
      
  2. Install the required Python packages:

    • Open a terminal and run the following command:
      pip install speechrecognition googletrans gtts
      

Usage:

  1. Specify the paths to FFmpeg and FFprobe executables in the script.
  2. Provide the input audio file in MP3 format (named "input.mp3") in the same directory as the script.

(FOR USE DIFFERENT LANGUAGE CHANGE: language="en-US" and here: lang="en" like example). To see all avalible lang type:

$ gtts-cli --all
  1. Run the script.
  2. The script will convert the input audio file to WAV format, recognize the speech using the Google Speech Recognition API, translate the text to a desired language using the Google Translate API, convert the translated text to speech using gTTS, and save the output audio file as "output.mp3".

Feel free to customize the code according to your specific requirements.

Enjoy exploring speech recognition and translation with Python!

speech-recognition-and-translation-with-python's People

Contributors

esorat avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.