dslclib.src.tts module#
- class dslclib.src.tts.QueueSupervisor(client, **kwargs)#
ベースクラス:
threading.Thread
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number.
args is the argument tuple for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
- kill()#
- run()#
Method representing the thread's activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- class dslclib.src.tts.SpeechConfig(text: str, engine: str = 'POLLY', speaker: str = 'Mizuki', pitch: int = 100, volume: int = 100, speed: int = 100, vocal_tract_length: int = 0, duration_information: bool = False, speechmark: bool = False)#
ベースクラス:
str
スピーチの設定の入力から,文字列を生成するstr継承クラス
SpeechConfig
- パラメータ:
text (str) --
engine (str, default = 'POLLY') --
speaker (str, default = 'Mizuki') --
pitch (int, default = 100) --
volume (int, default = 100) --
speed (int, default = 100) --
vocal_tract_length (int, default = 0) --
duration_information (bool, default = False) --
speechmark (bool, default = False) --
- class dslclib.src.tts.Text2SpeechClient(ip: str | None = None, port: int = 3456)#
ベースクラス:
dslclib.src.base.BaseClient
音声にしたい発話テキストをソケットに送信するクライアント
- パラメータ:
ip (str, optional) --
ipアドレス.
デフォルトはNoneであり,Noneが与えられた時,127.0.0.1(ローカルホスト)を指定し, もし,docker内でこのモジュールが立ち上がっていた場合,自動でそれが認識され,host.docker.internalを指定する.
host.docker.internalは,docker内からローカルホストのポートに接続するために必要である.
port (int = 3456) -- ソケット通信を行うポート.
サンプル
>>> client = Text2SpeechClient() ipがNoneだったため、127.0.0.1をipアドレスとして設定します。 >>> client Socket( ip = 127.0.0.1 port = 3456 ) >>>
- close() None #
ipアドレスのportへの接続を切る.
サンプル
>>> client = BaseClient() >>> client.connect() >>> client.close()
- is_speaking() bool #
音声を再生中かどうかを確認するメソッド
- monitor_queue()#
キューを監視し、合成音声の再生を終えたのちにキューからコマンドを削除するメソッド 注意: このメソッドは`self.supervisor`から呼び出されることを推奨する
- speech(text: str, engine: str = 'POLLY', speaker: str = 'Mizuki', pitch: int = 100, volume: int = 100, speed: int = 100, vocal_tract_length: int = 0, duration_information: bool = False, speechmark: bool = False, max_num_queue: int = 1, wait_queue: bool = False) None #
音声にしたい発話テキストと発話音声の設定を入力としてソケットに送信する関数
- パラメータ:
text (str) -- 発話テキスト
engine (str, default = 'POLLY') -- 音声エンジン
speaker (str, default = 'Mizuki') -- 話者
pitch (int, default = 100) -- ピッチ
volume (int, default = 100) -- ボリューム
speed (int, default = 100) -- 発話スピード
vocal_tract_length (int, default = 0) --
duration_information (bool, default = False) --
speechmark (bool, default = False) -- スピーチマークが含まれるかどうか
max_num_queue (int, default = 1) -- TTSコマンドのキューを最大いくつまでプールできるか
wait_queue (bool, default = False) -- max_num_queueのキュー数を超えた場合、キューが空くまで処理を待つかどうか。 `wait=False`に設定した場合、TTSのコマンドをキューにスタックせずに終了する。
- stop_speaking() None #
- wait_finish_speaking(timeout: float = -1.0) None #