mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-01-14 01:07:30 +08:00
fix play_p3 time
This commit is contained in:
parent
e777287463
commit
a1d150a0b4
@ -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播放已停止")
|
||||
@ -77,4 +77,4 @@ def main():
|
||||
play_p3_file(args.input_file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user