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
print "* start recoding *"
while count<TIME*5:
string_audio_data=stream.read(NUM_SAMPLES)
my_buf.append(string_audio_data)
count+=1
print '.'
#filename=datetime.now().strftime("%Y-%m-%d_%H_%M_%S")+".wav"
filename="01.wav"
save_wave_file(filename, my_buf)
stream.close()
print "* "+filename, "is saved! *"
评论列表
文章目录