This Python program enables users to translate speech to text and text to speech using various languages. It utilizes Google's Speech Recognition API, Google Translate API, and GenerativeAI's Gemini model.
Prerequisites:
- Python 3.x
Required Python libraries:
- speech_recognition -googletrans -tts (Assuming it's a custom library for text-to-speech functionality) -google.generativeai
Setup:
- Obtain a Google API key and replace GOOGLE_API_KEY variable with your API key.
- Ensure necessary Python libraries are installed. Usage:
- Run the program.
- Speak into the microphone when prompted.
- The program will translate the speech into text and then translate it into the desired language.
- The translated text will be synthesized into speech. Additional Notes:
- The program is set up to recognize speech in English, French, and Arabic.
- The translation of the recognized text is based on the language detected.
- If the recognized speech is unclear or cannot be translated accurately, the program prompts the user to repeat the input.
- Responses generated by the program are tailored to younger children under 10 years old, particularly focusing on explaining concepts related to robotics in a simple and concise manner. Disclaimer:
- This program heavily relies on external APIs for speech recognition, translation, and generative content generation. Make sure to comply with their terms of service and usage policies.
- The effectiveness of speech recognition and translation may vary depending on various factors such as ambient noise and speech clarity. Author: This program was developed by Mahdi Ben Ameur and Dhia Ben Hamouda and is distributed under the Apache2.0 License.
Acknowledgments:
- GenerativeAI for providing the Gemini model for generating responses.
- Contributors to the speech_recognition, googletrans, and tts libraries for enabling speech recognition and synthesis functionalities in Python.