Post

정말 오프라인 tts가 별로 없다.

전부 어디 웹에 들어가서 서버에 정보가 저장되는지 또다른 ai 재료로 써먹히는지 모른채

불안불안하게 TTS를 사용해야한다.

그러다가 프로그램 대용으로 파이썬 패키지 pyttsx3 을 설치하고 사용하는 법도 있다는 걸 알게되었다.

일단 window cmd창을 켜서 pyttsx3를 설치해준다.

pip install pyttsx3

그 후 아래 파이썬 코드를 실행시킨다.

https://www.geeksforgeeks.org/python/python-text-to-speech-by-using-pyttsx3/

 

Text to Speech by using pyttsx3 - Python - GeeksforGeeks

Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

www.geeksforgeeks.org

위에 프로퍼티 값을 어떻게 정의해야하는지 나온다. 그런데 속도... 난 200보다 더 높으면 좋겠데 200이 최대max이다.

너무 느려...

import pyttsx3

ttstest  = pyttsx3.init()
text = """테스트할 tts 샘플 텍스트입니다."""

ttstest.say(text)
#속도
ttstest.setProperty('rate', 200)

#실행
ttstest.runAndWait()

한글이 잘 나온다. 만족까진 아니지만 그럭저럭 사용하기 충분한 것 같다.

"""를 쓴 이유는 따옴표 안에 글자도 글자로 취급하기 위해서.

▲ top