Created
July 31, 2023 11:51
-
-
Save erenmustafaozdal/620153c3a8d4f79d803c83bb606e66a2 to your computer and use it in GitHub Desktop.
Metinden sese çevirme işlemi. Paketler: `gtts`, `playsound`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Metni konuşmaya dönüştürmek için gereken modülü içeri aktarın | |
from gtts import gTTS | |
# Dönüştürülmüş sesi çalmak için içe aktarım yapın | |
import os | |
# Sese dönüştürmek istediğiniz metin | |
metin = 'Merhaba Eren Mustafa Özdal' | |
# Dönüştürmek istediğiniz dil | |
dil = 'tr' | |
# Metni ve dili motor'a geçirin. Burada slow=False olarak işaretledik. Bu, | |
# dönüştürülen sesin yüksek hızda olmasını söyleyen modül | |
myobj = gTTS(text=metin, lang=dil, slow=False) | |
# Dönüştürülen sesi merhaba.mp3 adında bir mp3 dosyasında kaydedin | |
myobj.save("merhaba.mp3") | |
# Dönüştürülen dosyayı çalın | |
os.system("merhaba.mp3") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment