def update(frames): if self.stream.is_active(): slice = self.left.get_sample_slice(frames, frames + self.window) self.stream.write(slice.raw_data) y = np.array(slice.get_array_of_samples()) / 30000 points = np.array([np.cos(time), y]).T.reshape((-1, 1, 2)) # 控制曲线精细程度和振幅 segments = np.concatenate([points[:-1], points[1:]], axis=1) lc.set_segments(segments) lc.set_array(y) # 控制颜色 return lc,