Coder Social home page Coder Social logo

speech-to-text's Introduction

Speech-to-Text Recognition in Python

This is a simple Python script that demonstrates how to perform speech-to-text recognition using a microphone and the speech_recognition library. It uses Google's speech recognition service to transcribe the audio.

Requirements

To use this script, you'll need the following dependencies installed on your system:

  • Python 3.x
  • speech_recognition library
  • pyaudio library (for microphone input)

Installation

For Windows

  1. Install Python 3.x from the official website.

  2. Install pip, the package installer for Python, by following the instructions in the official documentation.

  3. Install pyaudio library by running the following command in a terminal or command prompt:

pip install pyaudio

If you encounter an error during installation, you may need to install portaudio separately. You can download portaudio from the official website or install it using a package manager such as Chocolatey.

  1. Install speech_recognition library by running the following command in a terminal or command prompt:
pip install SpeechRecognition

For Mac OS

  1. Install Homebrew by following the instructions on the official website.
  2. Install Python 3.x by running the following command in a terminal:
brew install python
  1. Install pyaudio library by running the following command in a terminal:
brew install portaudio
pip install pyaudio

If you encounter an error during installation, you may need to specify the path to portaudio manually. You can do this by running the following command instead:

pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio
  1. Install speech_recognition library by running the following command in a terminal:
pip install SpeechRecognition

Usage

  1. Open Jupyter Notebook and create a new notebook.
  2. Copy the following code into a cell:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
    print("Speak Anything :")
    audio = r.listen(source)
    try:
        text = r.recognize_google(audio)
        print("You said : {}".format(text))
    except:
        print("Sorry could not recognize what you said")
  1. Run the cell.
  2. Speak into your microphone when prompted by the script.
  3. The script will transcribe your speech and print the result to the console. If the script is unable to recognize your speech, it will print an error message.

Acknowledgments

  • This script was adapted from the speech_recognition library's documentation.

speech-to-text's People

Contributors

antonygn 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.