Spaces:
Running
Running
futurespyhi
commited on
Commit
·
15151e4
1
Parent(s):
af9b37e
1.update genre file write 2.update mix track logic for vocal and instrument
Browse files- YuE/inference/infer.py +9 -4
- app.py +2 -1
YuE/inference/infer.py
CHANGED
|
@@ -454,6 +454,8 @@ vocoder_stems_dir = os.path.join(vocoder_output_dir, 'stems')
|
|
| 454 |
vocoder_mix_dir = os.path.join(vocoder_output_dir, 'mix')
|
| 455 |
os.makedirs(vocoder_mix_dir, exist_ok=True)
|
| 456 |
os.makedirs(vocoder_stems_dir, exist_ok=True)
|
|
|
|
|
|
|
| 457 |
for npy in stage2_result:
|
| 458 |
if '_itrack' in npy:
|
| 459 |
# Process instrumental
|
|
@@ -477,10 +479,13 @@ for npy in stage2_result:
|
|
| 477 |
)
|
| 478 |
# mix tracks
|
| 479 |
try:
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
|
|
|
|
|
|
|
|
|
| 484 |
except RuntimeError as e:
|
| 485 |
print(e)
|
| 486 |
print(f"mix {vocoder_mix} failed! inst: {instrumental_output.shape}, vocal: {vocal_output.shape}")
|
|
|
|
| 454 |
vocoder_mix_dir = os.path.join(vocoder_output_dir, 'mix')
|
| 455 |
os.makedirs(vocoder_mix_dir, exist_ok=True)
|
| 456 |
os.makedirs(vocoder_stems_dir, exist_ok=True)
|
| 457 |
+
vocal_output = None
|
| 458 |
+
instrumental_output = None
|
| 459 |
for npy in stage2_result:
|
| 460 |
if '_itrack' in npy:
|
| 461 |
# Process instrumental
|
|
|
|
| 479 |
)
|
| 480 |
# mix tracks
|
| 481 |
try:
|
| 482 |
+
if vocal_output is not None and instrumental_output is not None:
|
| 483 |
+
mix_output = instrumental_output + vocal_output
|
| 484 |
+
vocoder_mix = os.path.join(vocoder_mix_dir, os.path.basename(recons_mix))
|
| 485 |
+
save_audio(mix_output, vocoder_mix, 44100, args.rescale)
|
| 486 |
+
print(f"Created mix: {vocoder_mix}")
|
| 487 |
+
else:
|
| 488 |
+
print("Error: Missing vocal or instrumental track for mixing")
|
| 489 |
except RuntimeError as e:
|
| 490 |
print(e)
|
| 491 |
print(f"mix {vocoder_mix} failed! inst: {instrumental_output.shape}, vocal: {vocal_output.shape}")
|
app.py
CHANGED
|
@@ -190,7 +190,8 @@ def generate_music_spaces(lyrics: str, genre: str, mood: str, progress=gr.Progre
|
|
| 190 |
|
| 191 |
# Create temporary files
|
| 192 |
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as genre_file:
|
| 193 |
-
genre_file.write(f"instrumental,{genre},{mood},male vocals")
|
|
|
|
| 194 |
genre_file_path = genre_file.name
|
| 195 |
|
| 196 |
# Convert lyrics format for YuE compatibility
|
|
|
|
| 190 |
|
| 191 |
# Create temporary files
|
| 192 |
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as genre_file:
|
| 193 |
+
# genre_file.write(f"instrumental,{genre},{mood},male vocals")
|
| 194 |
+
genre_file.write(f"{mood} female vocal {genre} vocal instrumental")
|
| 195 |
genre_file_path = genre_file.name
|
| 196 |
|
| 197 |
# Convert lyrics format for YuE compatibility
|