Coders Packet

Voice Based Temperature Convertor using SpeechRecognition in Python

By Pusuluri Sidhartha Aravind

  • coderspacket2/
  • A Python Project to perform basic temperature conversions between Kelvin, Celsius, and Fahrenheit using audio using libraries such as SpeechRecognition, pyttsx3, and gTTs.

    INTRODUCTION & FUNCTION:

    To perform the temperature conversions in python there is no direct method other than to perform it with the help of the formulas. But with the help of different libraries in python, it is possible to make this process completely voice-based without having to input any details by hand.

    In this project we use the different libraries mentioned below in the requirements section for the following uses:

    pyttsx3 is used for performing text to speech conversions and so we use it for the conversion of the python converted result to voice which allows the system to convey the result in an audio interface.

    SpeechRecognition is used to perform the speech-to-text conversion with the help of attributes like pause_threshold and adjust_for_ambient_noise, this then allows for the program to convert the audio into text which can then be converted into computer understandable language.

    gtts is both a CLI tool with Google Translate API and a python library.

    Within the code, the speak(audio,language) function performs the function of allowing the system to speak by converting the provided text into audio and presenting it which is the main aspect of interaction in the project.

    Within the code the myCommd(param) function allows the voice input to be taken by the system with a set pause threshold of 0.5. 

     

    REQUIREMENTS:

    1. Installed Python 2.6 or above.

    2. PyAudio installed as per the system specification.

    3. Further requirements:

    3.a. pyttsx3: CODE for installing--   pip install pyttsx3

    3.b. SpeechRecognition: CODE for installing--  pip install SpeechRecognition

    3.c. gtts: CODE for installing--    pip install gtts

    3.d. googletrans: CODE for installing--    pip install googletrans

     


    INPUT FORMAT:

    Operand Operation1 Connector Operation2

    Legend:

    Operand: any number

    Operation1: From operation, i.e, the format from which the operand is to be converted from

    Operation2: To operation, i.e, the format to which the operand is to be converted to

    Connector: to(no certain condition is applied to this)

     


    OUTPUT FORMAT:

    Sample Output

                                                                img 1.1

    The above-presented image shows how the interface works. The audio input follows the above-mentioned format. Sample output 2

                                                            img 1.2

    This image indicates the situation where there is no audio prompted by the user to the program. The last line "...." is a message displayed to the user indicating that the system is waiting for their response. The last line is the way to terminate the program properly.

     

    CONCLUSION:

    The output says the answer of the conversion as per the input provided and further asks if one wants to continue with different conversions. Upon providing the input no the termination sentence for the program is displayed as in the image img 1.1 and img 1.2.

    Download Complete Code

    Comments

    Comments for the packet "Voice Based Temperature Convertor using SpeechRecognition in Python";
    No comments yet