keyboard.py 文件源码

python
阅读 44 收藏 0 点赞 0 评论 0

项目:crescendo 作者: AriaFallah 项目源码 文件源码
def sensor2midi(self):
        # Read initial state until it's not empty
        initialState = []
        while initialState == []:
            initialState = self.sensor.getAllImages()
            sleep(0.2)

        # Observe touch events
        while True:
            sleep(0.01)
            state = self.sensor.getAllImages()
            if state:
                # Diff the initial state with the new state
                diff = np.subtract(initialState[-1]['image'], state[-1]['image'])
                self.activeRegions = np.unique(np.where(diff > 100)[1] // self.modulo)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号