From d06e32751d3e5b5f56a16ffb8098913b744a9c57 Mon Sep 17 00:00:00 2001 From: talksik Date: Thu, 27 Apr 2023 12:08:27 -0700 Subject: [PATCH] trying to fix deprecated numpy code --- mic_hat_examples/recording_examples/record_one_channel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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")