Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
音频文件仍在python中重复自身_Python_Audio_Python 3.6 - Fatal编程技术网

音频文件仍在python中重复自身

音频文件仍在python中重复自身,python,audio,python-3.6,Python,Audio,Python 3.6,当我运行以下代码时,即使在将条件设置为0(键盘\选择\帧)后,音频文件也会重复自身多次 以下是while循环的正确性,如下所示: if select_keyboard_menu is True: # Detecting gaze to select Left or Right keybaord gaze_ratio_left_eye = get_gaze_ratio([36, 37, 38, 39, 40, 41], landmarks)

当我运行以下代码时,即使在将条件设置为0(键盘\选择\帧)后,音频文件也会重复自身多次

以下是while循环的正确性,如下所示:

        if select_keyboard_menu is True:
        # Detecting gaze to select Left or Right keybaord
        gaze_ratio_left_eye = get_gaze_ratio([36, 37, 38, 39, 40, 41], landmarks)
        gaze_ratio_right_eye = get_gaze_ratio([42, 43, 44, 45, 46, 47], landmarks)
        gaze_ratio = (gaze_ratio_right_eye + gaze_ratio_left_eye) / 2

        if gaze_ratio <= 0.9:
            keyboard_selected = "right"
            keyboard_selection_frames += 1
            # If Kept gaze on one side more than 15 frames, move to keyboard
            if keyboard_selection_frames == 15:
                select_keyboard_menu = False
                right_sound.play()
                # Set frames count to 0 when keyboard selected
                frames = 0
                keyboard_selection_frames = 0
            if keyboard_selected != last_keyboard_selected:
                last_keyboard_selected = keyboard_selected
                keyboard_selection_frames = 0
        else:
            keyboard_selected = "left"
            keyboard_selection_frames += 1
            # If Kept gaze on one side more than 15 frames, move to keyboard
            if keyboard_selection_frames == 15:
                select_keyboard_menu = False
                left_sound.play()
                # Set frames count to 0 when keyboard selected
                frames = 0
            if keyboard_selected != last_keyboard_selected:
                last_keyboard_selected = keyboard_selected
                keyboard_selection_frames = 0
如果选择键盘菜单为真:
#检测凝视以选择左键或右键
凝视比率\左眼=获得凝视比率([36,37,38,39,40,41],地标)
凝视比率\右眼=获得凝视比率([42,43,44,45,46,47],地标)
凝视比率=(凝视比率\右眼+凝视比率\左眼)/2
如果有,则为u比