From 88adcaa6dca5cfc6f401d1387287d6a90ffbe50a Mon Sep 17 00:00:00 2001 From: lym0302 Date: Mon, 25 Apr 2022 10:51:35 +0800 Subject: [PATCH 1/3] fix code, test=doc --- demos/streaming_tts_server/test_client.sh | 4 ++-- paddlespeech/t2s/modules/predictor/length_regulator.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/demos/streaming_tts_server/test_client.sh b/demos/streaming_tts_server/test_client.sh index 333ae00d2..869820952 100644 --- a/demos/streaming_tts_server/test_client.sh +++ b/demos/streaming_tts_server/test_client.sh @@ -1,7 +1,7 @@ #!/bin/bash # http client test -paddlespeech_client tts --server_ip 127.0.0.1 --port 8092 --protocol http --input "您好,欢迎使用百度飞桨语音合成服务。" --output output.wav +paddlespeech_client tts_online --server_ip 127.0.0.1 --port 8092 --protocol http --input "您好,欢迎使用百度飞桨语音合成服务。" --output output.wav # websocket client test -#paddlespeech_client tts --server_ip 127.0.0.1 --port 8092 --protocol websocket --input "您好,欢迎使用百度飞桨语音合成服务。" --output output.wav \ No newline at end of file +#paddlespeech_client tts_online --server_ip 127.0.0.1 --port 8092 --protocol websocket --input "您好,欢迎使用百度飞桨语音合成服务。" --output output.wav diff --git a/paddlespeech/t2s/modules/predictor/length_regulator.py b/paddlespeech/t2s/modules/predictor/length_regulator.py index b64aa44ad..11f284087 100644 --- a/paddlespeech/t2s/modules/predictor/length_regulator.py +++ b/paddlespeech/t2s/modules/predictor/length_regulator.py @@ -49,7 +49,9 @@ class LengthRegulator(nn.Layer): encodings: (B, T, C) durations: (B, T) """ - batch_size, t_enc = durations.shape + #batch_size, t_enc = durations.shape + batch_size = paddle.shape(durations)[0] + t_enc = paddle.shape(durations)[1] durations = durations.numpy() slens = np.sum(durations, -1) t_dec = np.max(slens) From c6e621096406d862f0d738ecd02f6fa88adb44fd Mon Sep 17 00:00:00 2001 From: lym0302 Date: Mon, 25 Apr 2022 11:00:17 +0800 Subject: [PATCH 2/3] code format, test=tts --- paddlespeech/t2s/modules/predictor/length_regulator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paddlespeech/t2s/modules/predictor/length_regulator.py b/paddlespeech/t2s/modules/predictor/length_regulator.py index 11f284087..e4fbf5491 100644 --- a/paddlespeech/t2s/modules/predictor/length_regulator.py +++ b/paddlespeech/t2s/modules/predictor/length_regulator.py @@ -49,9 +49,9 @@ class LengthRegulator(nn.Layer): encodings: (B, T, C) durations: (B, T) """ - #batch_size, t_enc = durations.shape - batch_size = paddle.shape(durations)[0] - t_enc = paddle.shape(durations)[1] + #batch_size, t_enc = durations.shape # linux + batch_size = paddle.shape(durations)[0] # windows and mac + t_enc = paddle.shape(durations)[1] # windows and mac durations = durations.numpy() slens = np.sum(durations, -1) t_dec = np.max(slens) From dc52c313fac145e1826af7f81276179065e269a7 Mon Sep 17 00:00:00 2001 From: lym0302 Date: Mon, 25 Apr 2022 11:03:59 +0800 Subject: [PATCH 3/3] fix code, test=doc --- paddlespeech/server/utils/audio_process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddlespeech/server/utils/audio_process.py b/paddlespeech/server/utils/audio_process.py index c6dad8891..6fb5bb832 100644 --- a/paddlespeech/server/utils/audio_process.py +++ b/paddlespeech/server/utils/audio_process.py @@ -157,7 +157,7 @@ def save_audio(bytes_data, audio_path, sample_rate: int=24000) -> bool: if audio_path.endswith("pcm"): with open(audio_path, "wb") as f: - f.write(bubytes_dataffer) + f.write(bytes_data) elif audio_path.endswith("wav"): with open("./tmp.pcm", "wb") as f: f.write(bytes_data)