trying to fix deprecated numpy code
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user