From b41d3dec032cf7879acca34aa3e69fa6a21f03c3 Mon Sep 17 00:00:00 2001 From: wkyo Date: Fri, 21 Aug 2020 12:03:26 +0800 Subject: [PATCH] rename speech recorder and update --- speech-recorder.py | 49 --------------------------- speech_recorder.py | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 49 deletions(-) delete mode 100644 speech-recorder.py create mode 100644 speech_recorder.py diff --git a/speech-recorder.py b/speech-recorder.py deleted file mode 100644 index c4aed9e..0000000 --- a/speech-recorder.py +++ /dev/null @@ -1,49 +0,0 @@ -import wave -from pyaudio import PyAudio,paInt16 - -framerate=16000 -NUM_SAMPLES=2000 -channels=1 -sampwidth=2 -TIME=10 -def save_wave_file(filename,data): - '''save the date to the wavfile''' - wf=wave.open(filename,'wb') - wf.setnchannels(channels) - wf.setsampwidth(sampwidth) - wf.setframerate(framerate) - wf.writeframes(b"".join(data)) - wf.close() - -def my_record(): - pa=PyAudio() - stream=pa.open(format = paInt16,channels=1, - rate=framerate,input=True, - frames_per_buffer=NUM_SAMPLES) - my_buf=[] - count=0 - while count