Merge pull request #1774 from lym0302/add_streaming_cli

[server] fix tts streaming server
pull/1779/head
liangym 3 years ago committed by GitHub
commit 0de4d25ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
#paddlespeech_client tts_online --server_ip 127.0.0.1 --port 8092 --protocol websocket --input "您好,欢迎使用百度飞桨语音合成服务。" --output output.wav

@ -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)

@ -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 # 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)

Loading…
Cancel
Save