Compare commits
1 Commits
3b939b8ce9
...
afeeb3bb78
Author | SHA1 | Date | |
---|---|---|---|
![]() |
afeeb3bb78 |
@ -117,6 +117,7 @@ class AudioInferenceHandler(AudioHandler):
|
|||||||
img_batch = []
|
img_batch = []
|
||||||
index_list = []
|
index_list = []
|
||||||
# for i in range(batch_size):
|
# for i in range(batch_size):
|
||||||
|
# TODO: 推理状态下获取循环帧逻辑
|
||||||
for i in range(len(mel_batch)):
|
for i in range(len(mel_batch)):
|
||||||
# idx = mirror_index(length, index + i)
|
# idx = mirror_index(length, index + i)
|
||||||
idx = human_status.get_index()
|
idx = human_status.get_index()
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#encoding = utf8
|
#encoding = utf8
|
||||||
|
from utils.loop_frame_tool import play_in_loop_v2
|
||||||
import logging
|
|
||||||
|
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
@ -20,6 +17,9 @@ class HumanStatus:
|
|||||||
self._current_frame = 0
|
self._current_frame = 0
|
||||||
self._is_talking = False
|
self._is_talking = False
|
||||||
|
|
||||||
|
self.last_frame_talking_status = "silent" # 记录上一帧讲话状态
|
||||||
|
self.next_frame_talking_status = "silent"
|
||||||
|
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
return self._status
|
return self._status
|
||||||
|
|
||||||
@ -52,6 +52,28 @@ class HumanStatus:
|
|||||||
self._current_frame = (self._current_frame + 1) % self._total_frames
|
self._current_frame = (self._current_frame + 1) % self._total_frames
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
def get_index_v2(self):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
frame_config = []
|
||||||
|
audio_frame_length = batch_size = 5
|
||||||
|
is_silent = True if not self._is_talking else False
|
||||||
|
first_speak = True if self._is_talking and self.last_frame_talking_status == "silent" else False
|
||||||
|
last_speak = True if self.last_frame_talking_status == "talk" and self.next_frame_talking_status == "silent" else False
|
||||||
|
start_idx_list, last_direction = play_in_loop_v2(
|
||||||
|
frame_config,
|
||||||
|
startfrom,
|
||||||
|
audio_frame_length,
|
||||||
|
last_direction,
|
||||||
|
is_silent,
|
||||||
|
first_speak,# 刚开始讲话 向讲话移动
|
||||||
|
last_speak, # 讲话结束 向静默移动
|
||||||
|
)
|
||||||
|
startfrom = start_idx_list[-1]
|
||||||
|
# 一次返回一个batch帧号
|
||||||
|
return start_idx_list
|
||||||
|
|
||||||
|
|
||||||
def start_talking(self):
|
def start_talking(self):
|
||||||
self._is_talking = True
|
self._is_talking = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user