diff --git a/mic_hat_examples/recording_examples/record_one_channel.py b/mic_hat_examples/recording_examples/record_one_channel.py index aef5c2d..e25228f 100644 --- a/mic_hat_examples/recording_examples/record_one_channel.py +++ b/mic_hat_examples/recording_examples/record_one_channel.py @@ -22,13 +22,13 @@ stream = p.open( print("* recording") -frames = [] +frames = [] for i in range(0, int(RESPEAKER_RATE / CHUNK * RECORD_SECONDS)): data = stream.read(CHUNK) # extract channel 0 data from 2 channels, if you want to extract channel 1, please change to [1::2] - a = np.fromstring(data,dtype=np.int16)[0::2] - frames.append(a.tostring()) + a = np.frombuffer(data, dtype=np.int16)[0::2] + frames.append(a.tobytes()) print("* done recording")