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
|
time.sleep(60 / 1000) # 60ms
|
||||||
|
|
||||||
# 播放结束后添加0.5秒静音,避免破音
|
# 播放结束后添加1秒静音,避免破音
|
||||||
silence = np.zeros(int(sample_rate / 2), dtype=np.int16)
|
silence = np.zeros(int(sample_rate), dtype=np.int16)
|
||||||
stream.write(silence)
|
stream.write(silence)
|
||||||
time.sleep(0.5) # 等待1秒
|
time.sleep(1) # 等待1秒
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\n播放已停止")
|
print("\n播放已停止")
|
||||||
@@ -77,4 +77,4 @@ def main():
|
|||||||
play_p3_file(args.input_file)
|
play_p3_file(args.input_file)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user