GithubHelp home page GithubHelp logo

santhanalakshmi04 / experiment-5--implementation-of-speech-recognition Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lavanyajoyce/experiment-5--implementation-of-speech-recognition

0.0 0.0 0.0 4 KB

experiment-5--implementation-of-speech-recognition's Introduction

Experiment-7--Implementation-of-Speech-Recognition

Aim:

Construct a python program to implement speech recognition.

EQUIPMENTS REQUIRED:

Hardware โ€“ PCs Anaconda โ€“ Python 3.7 Installation / Google Colab /Jupiter Notebook

Algorithm:

Step 1:Import the speech_recognition module as sr.
Step 2:Assign a string variable "file" with the name of the audio file that you want to transcribe.
Step 3:Create an instance of the Recognizer class called "r".
Step 4:Use the AudioFile() method of sr to create an AudioFile object with the audio file name passed as an argument.
Step 5:Use the record() method of r to read the audio data from the AudioFile object and store it in the variable "audio".
Step 6:Use the recognize_google() method of r to transcribe the audio data stored in the "audio" variable.
Step 7:Print the transcribed text on the console if the transcribe process was successful.
Step 8:Handle any potential errors during the transcribing process. If the audio is not clear, print "not clear". If there's an error while trying to retrieve the transcribed text from the Google speech recognizer, print "Couldnt get results from google speech recognizer".

Program:

Developed By : K.SANTHANA LAKSHMI
Register Number : 212221240091
import speech_recognition as sr

# Assign a string variable "file" with the name of the audio file that you want to transcribe.
file = "speech.wav"

# Create an instance of the Recognizer class called "r".
r = sr.Recognizer()

# Use the AudioFile() method of sr to create an AudioFile object with the audio file name passed as an argument.
with sr.AudioFile(file) as source:
    audio = r.record(source)

# Use the recognize_google() method of r to transcribe the audio data stored in the "audio" variable.
try:
    text = r.recognize_google(audio)
except sr.UnknownValueError:
    print("Not clear")
except sr.RequestError as e:
    print("Couldn't get results from Google Speech Recognition service; {0}".format(e))

# Print the text in the next lines.
for line in text.splitlines():
    print(line)

Output:

output

Result:

Thus, we have implemented a program that will transcribe the audio file in the file variable and print the transcribed text on the console, one line at a time.

experiment-5--implementation-of-speech-recognition's People

Contributors

lavanyajoyce avatar santhanalakshmi04 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.