Skip to main content

Fahrenheit temperature and Kelvin changing in Celsius temperature with text in speech


Fahrenheit temperature and Kelvin changing in Celsius temperature with out in speech

If you want of this source code in java language so click on it

How to speech of output :

first we need to  import gtts and playsound package in python our code editer because in this program we want to speech of every output .

then we will save of this variable with obj.save("any_name.mp3")   and we also want to speech of this. after saving of this. we write like this playsound("any_name.mp3")  for speech of obj.save.

It is only for Text speech

you can also use of this code-source for text -speech 

#librery which by we can change text in speech in present of internt your system
from gtts import gTTS

#import playsound for play text speech
from playsound import playsound

#syntax of this is variable_name=gTTS(text="your text ", lang='language' ,slow=True or False)
obj=gTTS(text="text here for speeching ok my dear ",lang='en', slow=False)
#obj save like this withh anyname.mp3
obj.save("abhijeet.mp3")




How to change fahrenheit and kelvin temperature in celsius temperature 

for this first we need to show two option ahead to user that select 1 for Fahrenheit to celsius temperate 
or enter 2 for kelvin to celsius temperature 
for this we take a input 
and if user  enter  any value then we check of this. if user enter 1
then we insert if condition if

if inp==1:
ob=gTTS(text=" inter your temperature here in fahreheit ",lang='en',slow=False)
ob.save("second.mp3")
playsound("second.mp3")

inp=float(input("enter your temperature here in fahreheit "))
o=gTTS(text='it is changed temperature in fahreheit in celsius')
o.save("third.mp3")

#formula for changing fahrenheit in celsius
totall=((inp-32)/(1.8))

print(totall)
playsound('third.mp3')


but if user enter 2 then we write of this condition 

elif inp==2:
ok=gTTS(text=" inter your temperature in kelvin ", lang='en',slow=False)
ok.save("ok.mp3")
playsound("ok.mp3")
inpu_second=float(input("inter your temperature in kelvin "))

#formula for changing kelvin in celsius
to=float(inpu_second-273)

s=gTTS(text="your enter temperature has been changed in kelvin",lang='en' ,slow=False)
s.save("s.mp3")

print("your enter temperature has been changed in kelvin ")

print(to)
playsound("s.mp3")

 what happen if user did not enter both value in this case we need to show elif statement 

el=gTTS(text="sorry wrong input please try again ",lang='en',slow=False)
el.save("forth.mp3")
print("sorry wrong input please try again ")
playsound("forth.mp3")


it is all source code for this project

you can use of this sources code through copy and paste 




#librery which by we can change text in speech in present of internt your system
from gtts import gTTS

#import playsound for play text speech
from playsound import playsound

#syntax of this is variable_name=gTTS(text="your text ", lang='language' ,slow=True or False)
obj=gTTS(text="For fahreheit to celsius press 1. or kelvin to celsius press 2 ",lang='en', slow=False)
#obj save like this withh anyname.mp3
obj.save("abhijeet.mp3")

#play of this save speech with playsound function
playsound("abhijeet.mp3")


inp= int(input("please here here"))
if inp==1:
ob=gTTS(text=" inter your temperature here in fahreheit ",lang='en',slow=False)
ob.save("second.mp3")
playsound("second.mp3")

inp=float(input("enter your temperature here in fahreheit "))
o=gTTS(text='it is changed temperature in fahreheit in celsius')
o.save("third.mp3")

#formula for changing fahrenheit in celsius
totall=((inp-32)/(1.8))

print(totall)
playsound('third.mp3')
elif inp==2:
ok=gTTS(text=" inter your temperature in kelvin ", lang='en',slow=False)
ok.save("ok.mp3")
playsound("ok.mp3")
inpu_second=float(input("inter your temperature in kelvin "))

#formula for changing kelvin in celsius
to=float(inpu_second-273)

s=gTTS(text="your enter temperature has been changed in kelvin",lang='en' ,slow=False)
s.save("s.mp3")

print("your enter temperature has been changed in kelvin ")

print(to)
playsound("s.mp3")

else:
el=gTTS(text="sorry wrong input please try again ",lang='en',slow=False)
el.save("forth.mp3")
print("sorry wrong input please try again ")
playsound("forth.mp3")

Comments