connect@howdiyworld.com
|

Text-to-Speech Convert

What is Needed?

3.5 mm Audio Jack
Speaker or Head set
HowDIY

BLOCK DIAGRAM

Procedure

  1. 3.5 mm Jack and Speaker
  2. Connections
  3. Program
  4. Output

Speaker and 3.5 mm Audio Jack

Speakers work by converting electrical energy into mechanical energy (motion). … In speakers, a current is sent through the voice coil which produces an electric field that interacts with the magnetic field of the permanent magnet attached to the speaker. Like charges repel each other and different charges attract.

Connections

  •                3.5mm Audio jack connect to Raspberry Pi and Speaker.

Python Program

import time

from gtts import gTTS

# import Os module to start the audio file

import os

language = ‘en’      # Select your Language

def get_input(mytext):

myobj = gTTS(text=mytext, lang=language, slow=False) # Google convert text to speech

myobj.save(“output.mp3")              #save the audio file

os.system(“omxplayer output.mp3")        #play the audio in omxplayer in raspberry pi

Output

Here you can give an input text it will be convert to speech and say via speaker.

Social media & sharing icons powered by UltimatelySocial
Facebook
Twitter
YouTube
LinkedIn
Instagram