fix play_p3 time

This commit is contained in:
Xiaoxia
2025-03-14 03:06:49 +08:00
parent e777287463
commit a1d150a0b4

View File

@@ -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播放已停止")