forked from xiaozhi/xiaozhi-esp32
fix play_p3 time
This commit is contained in:
@@ -57,10 +57,10 @@ def play_p3_file(input_file):
|
||||
# 等待一帧的时间
|
||||
time.sleep(60 / 1000) # 60ms
|
||||
|
||||
# 播放结束后添加0.5秒静音,避免破音
|
||||
silence = np.zeros(int(sample_rate / 2), dtype=np.int16)
|
||||
# 播放结束后添加1秒静音,避免破音
|
||||
silence = np.zeros(int(sample_rate), dtype=np.int16)
|
||||
stream.write(silence)
|
||||
time.sleep(0.5) # 等待1秒
|
||||
time.sleep(1) # 等待1秒
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n播放已停止")
|
||||
|
||||
Reference in New Issue
Block a user