Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
고급 단계
기초적인 사용법
텍스트 음성 변환의 기본 사용에는 다음과 같은 일회성 단계가 포함됩니다.
프로젝트의 Godot 편집기에서 TTS를 활성화하세요
사용 가능한 음성 목록을 시스템에 쿼리합니다.
사용하려는 음성의 ID를 저장하세요.
기본적으로 텍스트 음성 변환에 대한 Godot 프로젝트 수준 설정은 불필요한 오버헤드를 피하기 위해 비활성화되어 있습니다. 활성화하려면:
프로젝트 -> 프로젝트 설정으로 이동하세요
고급 설정 토글이 활성화되어 있는지 확인하세요
오디오 > 일반을 클릭하세요
텍스트 음성 변환 옵션이 체크되어 있는지 확인하세요
메시지가 나타나면 Godot를 다시 시작하세요.
텍스트 음성 변환은 특정 음성을 사용합니다. 사용자의 시스템에 따라 여러 개의 음성이 설치되어 있을 수 있습니다. 음성 ID가 있으면 이를 사용하여 텍스트를 말할 수 있습니다.
# One-time steps.
# Pick a voice. Here, we arbitrarily pick the first English voice.
var voices = DisplayServer.tts_get_voices_for_language("en")
var voice_id = voices[0]
# Say "Hello, world!".
DisplayServer.tts_speak("Hello, world!", voice_id)
# Say a longer sentence, and then interrupt it.
# Note that this method is asynchronous: execution proceeds to the next line immediately,
# before the voice finishes speaking.
var long_message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur"
DisplayServer.tts_speak(long_message, voice_id)
# Immediately stop the current text mid-sentence and say goodbye instead.
DisplayServer.tts_stop()
DisplayServer.tts_speak("Goodbye!", voice_id)
// One-time steps.
// Pick a voice. Here, we arbitrarily pick the first English voice.
string[] voices = DisplayServer.TtsGetVoicesForLanguage("en");
string voiceId = voices[0];
// Say "Hello, world!".
DisplayServer.TtsSpeak("Hello, world!", voiceId);
// Say a longer sentence, and then interrupt it.
// Note that this method is asynchronous: execution proceeds to the next line immediately,
// before the voice finishes speaking.
string longMessage = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur";
DisplayServer.TtsSpeak(longMessage, voiceId);
// Immediately stop the current text mid-sentence and say goodbye instead.
DisplayServer.TtsStop();
DisplayServer.TtsSpeak("Goodbye!", voiceId);
기능에 대한 요구 사항
Godot에는 텍스트 음성 변환 기능이 포함되어 있습니다. :ref:`DisplayServer 클래스 <class_DisplayServer>`에서 이를 찾을 수 있습니다.
Godot는 텍스트 음성 변환 기능을 위해 시스템 라이브러리에 의존합니다. 이러한 라이브러리는 Windows, macOS, 웹, Android 및 iOS에 기본적으로 설치되지만 모든 Linux 배포판에는 설치되지 않습니다. 존재하지 않으면 텍스트 음성 변환 기능이 작동하지 않습니다. 특히 tts_get_voices() 메서드는 사용 가능한 음성이 없음을 나타내는 빈 목록을 반환합니다.
Linux의 Godot 사용자와 Godot 게임을 실행하는 Linux의 최종 사용자 모두 시스템에 텍스트 음성 변환이 작동할 수 있는 시스템 라이브러리가 포함되어 있는지 확인해야 합니다. 어떤 라이브러리를 설치해야 하는지 결정하려면 아래 표나 배포판 설명서를 참조하세요.
배포판별 단일 라이너
아치 리눅스 |
pacman -S speech-dispatcher festival espeakup
|
문제 해결
var voice_id = voices[0] 줄에 대해 Invalid get index '0' (on base: 'PackedStringArray'). 오류가 발생하면 `voices`에 항목이 있는지 확인하세요. 그렇지 않은 경우:
모든 사용자: 프로젝트 설정에서 **텍스트 음성 변환**을 활성화했는지 확인하세요.
Linux 사용자: 텍스트 음성 변환을 위한 시스템별 라이브러리를 설치했는지 확인하세요.
모범 사례
시각 장애인 플레이어를 위한 이상적인 플레이어 경험 측면에서 텍스트 음성 변환의 모범 사례는 출력을 플레이어의 화면 판독기로 보내는 것입니다. 이를 통해 사용자가 설정한 언어, 속도, 피치 등의 선택이 유지될 뿐만 아니라 플레이어가 텍스트를 앞뒤로 스크롤할 수 있는 것과 같은 고급 기능이 허용됩니다. 현재 Godot는 이러한 수준의 통합을 제공하지 않습니다.
Godot 텍스트-음성 API의 현재 상태에서 모범 사례는 다음과 같습니다:
텍스트 음성 변환을 활성화하여 게임을 개발하고 모든 소리가 올바른지 확인하세요.
플레이어가 사용할 음성을 제어하고 게임 세션 전반에 걸쳐 해당 선택을 저장/지속할 수 있도록 허용합니다.
플레이어가 말하기 속도를 제어하고 게임 세션 전반에 걸쳐 해당 선택 사항을 저장/지속할 수 있도록 허용합니다.
이를 통해 시각 장애인 플레이어에게 화면 판독기를 사용하지 않을 때 최대한의 유연성과 편안함을 제공하고 좌절감과 소외감을 최소화할 수 있습니다.
경고 및 기타 정보
tts_speak 및 `tts_stop`에 전화하면 지연이 예상됩니다. 실제 지연 시간은 OS와 컴퓨터 사양에 따라 다릅니다. 이는 일부 음성이 웹 서비스에 따라 달라지고 실제 재생 시간이 서버 로드, 네트워크 대기 시간 및 기타 요인에 따라 달라지는 Android 및 웹에서 특히 중요합니다.
올바른 음성을 설치하고 사용하면 영어가 아닌 텍스트가 작동합니다. Windows에서는 `this article`_의 지침을 참조하여 Windows에서 추가 언어 음성을 활성화할 수 있습니다.
움라우트와 같은 비ASCII 문자는 올바른 음성을 선택하면 올바르게 발음됩니다.
시각 장애인 플레이어는 JAWS, NVDA, VoiceOver, 내레이터 등을 포함한 다양한 화면 판독기를 사용합니다.
Windows 텍스트 음성 변환 API는 일반적으로 다른 시스템의 해당 API보다 더 나은 성능을 발휘합니다(예: tts_stop 다음에 `tts_speak`가 즉시 새 메시지를 말합니다).