Fix frame_length too short bug.

This commit is contained in:
Yisheng (Ethan) He
2025-09-03 19:00:00 +08:00
committed by GitHub
parent c29a6f38f8
commit 45451ca6d2

View File

@@ -168,7 +168,7 @@ class Audio2ExpressionInfer(InferBase):
frame_length = math.ceil(audio.shape[0] / ssr * 30) frame_length = math.ceil(audio.shape[0] / ssr * 30)
output_context = DEFAULT_CONTEXT.copy() output_context = DEFAULT_CONTEXT.copy()
volume = librosa.feature.rms(y=audio, frame_length=int(1 / 30 * ssr), hop_length=int(1 / 30 * ssr))[0] volume = librosa.feature.rms(y=audio, frame_length=min(int(1 / 30 * ssr), len(audio)), hop_length=int(1 / 30 * ssr))[0]
if (volume.shape[0] > frame_length): if (volume.shape[0] > frame_length):
volume = volume[:frame_length] volume = volume[:frame_length]