未验证 提交 9553eaa1 编写于 作者: B blue-fish 提交者: GitHub

Catch PortAudioError exception so it is not fatal (#417)

上级 ad7f01d5
......@@ -170,8 +170,14 @@ if __name__ == '__main__':
# Play the audio (non-blocking)
if not args.no_sound:
sd.stop()
sd.play(generated_wav, synthesizer.sample_rate)
try:
sd.stop()
sd.play(generated_wav, synthesizer.sample_rate)
except sd.PortAudioError as e:
print("\nCaught exception: %s" % repr(e))
print("Continuing without audio playback. Suppress this message with the \"--no_sound\" flag.\n")
except:
raise
# Save it on the disk
filename = "demo_output_%02d.wav" % num_generated
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册