def record(record_time, output_file, pause_time = 1): print("Recording audio for " + str(record_time) + "s...") ledmatrix.set_all(255, 0, 0) ledmatrix.show() microphone.record() sleep(record_time) microphone.stop() ledmatrix.off() microphone.save(output_file, True) print("Saved to " + output_file) print("") pause(pause_time)
def exit(): if mic.is_recording(): mic.stop() mic.save("/tmp/pt-avs/req.wav", True) sys.exit(0)