<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: charan</title>
    <description>The latest articles on DEV Community by charan (@t_sricharan).</description>
    <link>https://dev.to/t_sricharan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F774471%2Fcc3645f4-0135-4ef4-bd7a-32a383f5ce72.jpg</url>
      <title>DEV Community: charan</title>
      <link>https://dev.to/t_sricharan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/t_sricharan"/>
    <language>en</language>
    <item>
      <title>Python text to speech conversion
</title>
      <dc:creator>charan</dc:creator>
      <pubDate>Tue, 14 Dec 2021 16:41:53 +0000</pubDate>
      <link>https://dev.to/t_sricharan/python-text-to-speech-conversion-lpd</link>
      <guid>https://dev.to/t_sricharan/python-text-to-speech-conversion-lpd</guid>
      <description>&lt;p&gt;In order to convert a given text to speech, In python, we use &lt;code&gt;pyttsx3&lt;/code&gt; module. pyttsx3 is a text-to-speech conversion library in Python. It works offline, and is compatible with both Python 2 and 3.&lt;/p&gt;

&lt;p&gt;Use this command for installation:&lt;/p&gt;

&lt;p&gt;** pip install pyttsx3&lt;br&gt;
**&lt;/p&gt;

&lt;p&gt;**Usage:&lt;br&gt;
**First we need to import the module &lt;code&gt;pyttsx3&lt;/code&gt; using import statement. Then we need to initialize it using &lt;code&gt;init()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;After initializing, we need the program to speak using &lt;code&gt;say()&lt;/code&gt; function. This takes two arguments as below:&lt;/p&gt;

&lt;p&gt;say(text, name string)&lt;/p&gt;

&lt;p&gt;text : Any text you wish to hear.&lt;br&gt;
 name : To set a name for this speech. (optional)&lt;/p&gt;

&lt;p&gt;To run the speech we use runAndWait(). The say() function texts won’t be said unless the interpreter encounters runAndWait().&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Code #1:&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  importing the pyttsx library
&lt;/h1&gt;

&lt;p&gt;import pyttsx3 &lt;/p&gt;

&lt;h1&gt;
  
  
  initialisation
&lt;/h1&gt;

&lt;p&gt;engine = pyttsx3.init() &lt;/p&gt;

&lt;h1&gt;
  
  
  testing
&lt;/h1&gt;

&lt;p&gt;engine.say("Hello world")&lt;br&gt;
engine.say("My first code on text-to-speech")&lt;br&gt;
engine.runAndWait() &lt;/p&gt;

&lt;p&gt;We can also change voice (Male or Female) and manage volume control, Also, we can increase or decrease voice rate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Code #2:&lt;/strong&gt;&lt;br&gt;
Changing Voice, Volume and Voice rate:&lt;/p&gt;

&lt;p&gt;import pyttsx3&lt;br&gt;
engine = pyttsx3.init() # object creation&lt;/p&gt;

&lt;p&gt;""" &lt;strong&gt;RATE&lt;/strong&gt;"""&lt;br&gt;
rate = engine.getProperty('rate')   # getting details of current speaking rate&lt;br&gt;
print (rate)                                         # printing current voice rate&lt;br&gt;
engine.setProperty('rate', 125)      # setting up new voice rate&lt;/p&gt;

&lt;p&gt;"""&lt;strong&gt;VOLUME&lt;/strong&gt;"""&lt;br&gt;
volume = engine.getProperty('volume')   # getting to know current volume level (min=0 and max=1)&lt;br&gt;
print (volume)                                               # printing current volume level&lt;br&gt;
engine.setProperty('volume',1.0)      # setting up volume level  between 0 and 1&lt;/p&gt;

&lt;p&gt;"""&lt;strong&gt;VOICE&lt;/strong&gt;"""&lt;br&gt;
voices = engine.getProperty('voices')           # getting details of current voice&lt;/p&gt;

&lt;h1&gt;
  
  
  engine.setProperty('voice', voices[0].id)  # changing index, changes voices. o for male
&lt;/h1&gt;

&lt;p&gt;engine.setProperty('voice', voices[1].id)     # changing index, changes voices. 1 for female&lt;/p&gt;

&lt;p&gt;engine.say("Hello World!")&lt;br&gt;
engine.say('My current speaking rate is ' + str(rate))&lt;br&gt;
engine.say('The quick brown fox jumped over the lazy dog.')&lt;br&gt;
engine.runAndWait()&lt;br&gt;
engine.stop()&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Python code to check which number is greater.</title>
      <dc:creator>charan</dc:creator>
      <pubDate>Tue, 14 Dec 2021 16:37:23 +0000</pubDate>
      <link>https://dev.to/t_sricharan/python-code-to-check-which-number-is-greater-3g1m</link>
      <guid>https://dev.to/t_sricharan/python-code-to-check-which-number-is-greater-3g1m</guid>
      <description>&lt;h1&gt;
  
  
  Python program to find the largest number among the three input numbers
&lt;/h1&gt;

&lt;h1&gt;
  
  
  take three numbers from user
&lt;/h1&gt;

&lt;p&gt;num1 = float(input("Enter first number: "))&lt;br&gt;
num2 = float(input("Enter second number: "))&lt;br&gt;
num3 = float(input("Enter third number: "))&lt;/p&gt;

&lt;p&gt;if (num1 &amp;gt; num2) and (num1 &amp;gt; num3):&lt;br&gt;
 largest = num1&lt;br&gt;
elif (num2 &amp;gt; num1) and (num2 &amp;gt; num3):&lt;br&gt;
 largest = num2&lt;br&gt;
else:&lt;br&gt;
 largest = num3&lt;/p&gt;

&lt;p&gt;print("The largest number is",largest)&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Sample Output:&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Enter first number: 100&lt;br&gt;
Enter second number: 120&lt;br&gt;
Enter third number: 10&lt;br&gt;
The largest number is 120&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
