trying to fix deprecated numpy code

This commit is contained in:
talksik
2023-04-27 12:08:27 -07:00
parent 701448c9c2
commit d06e32751d
@@ -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")