Spaces:
Runtime error
Runtime error
Commit
·
c2e61ce
1
Parent(s):
ba5070f
chunk bug
Browse files
app.py
CHANGED
|
@@ -110,8 +110,10 @@ def svc_change(argswave, argsspk):
|
|
| 110 |
out_chunk = 2500 # 25 S
|
| 111 |
out_index = 0
|
| 112 |
out_audio = []
|
|
|
|
| 113 |
|
| 114 |
while (out_index + out_chunk < all_frame):
|
|
|
|
| 115 |
if (out_index == 0): # start frame
|
| 116 |
cut_s = out_index
|
| 117 |
cut_s_48k = 0
|
|
@@ -139,8 +141,12 @@ def svc_change(argswave, argsspk):
|
|
| 139 |
out_index = out_index + out_chunk
|
| 140 |
|
| 141 |
if (out_index < all_frame):
|
| 142 |
-
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
sub_ppg = ppg[cut_s:, :].unsqueeze(0).to(device)
|
| 145 |
sub_pit = pit[cut_s:].unsqueeze(0).to(device)
|
| 146 |
sub_len = torch.LongTensor([all_frame - cut_s]).to(device)
|
|
|
|
| 110 |
out_chunk = 2500 # 25 S
|
| 111 |
out_index = 0
|
| 112 |
out_audio = []
|
| 113 |
+
has_audio = False
|
| 114 |
|
| 115 |
while (out_index + out_chunk < all_frame):
|
| 116 |
+
has_audio = True
|
| 117 |
if (out_index == 0): # start frame
|
| 118 |
cut_s = out_index
|
| 119 |
cut_s_48k = 0
|
|
|
|
| 141 |
out_index = out_index + out_chunk
|
| 142 |
|
| 143 |
if (out_index < all_frame):
|
| 144 |
+
if (has_audio):
|
| 145 |
+
cut_s = out_index - hop_frame
|
| 146 |
+
cut_s_48k = hop_frame * hop_size
|
| 147 |
+
else:
|
| 148 |
+
cut_s = 0
|
| 149 |
+
cut_s_48k = 0
|
| 150 |
sub_ppg = ppg[cut_s:, :].unsqueeze(0).to(device)
|
| 151 |
sub_pit = pit[cut_s:].unsqueeze(0).to(device)
|
| 152 |
sub_len = torch.LongTensor([all_frame - cut_s]).to(device)
|