axeldelafosse / stemgen

🎛 Stemgen is a Stem file generator. Convert any track into a Stem and have fun with Traktor.
https://stemgen.dev
MIT License
212 stars 39 forks source link

Converting multiple songs at once? #31

Closed jsahn93 closed 3 months ago

jsahn93 commented 1 year ago

I'd like to convert 200+ files into stem files. I tried running a bash loop overnight, and it deleted all but the last song during the "Cleaning..." process...

How can I do this?

kartguru commented 1 year ago

I don't have a solution @jsahn93 , but can you share your script please?

jsahn93 commented 1 year ago

I don't have a solution @jsahn93 , but can you share your script please?

for file in *.wav; do python3 stemgen.py -i "$file" done

Here it is

MacTheZazou commented 1 year ago

You can use this and put your script in \sources\

import os
import subprocess

# Chemin vers le sous-dossier contenant les fichiers .flac
source_dir = "./sources"

# Récupérer tous les fichiers .flac dans le sous-dossier sources
flac_files = [f for f in os.listdir(source_dir) if f.endswith('.flac')]

for flac_file in flac_files:
    # Chemin complet vers le fichier .flac
    full_path = os.path.join(source_dir, flac_file)

    # Construire la commande à exécuter
    cmd = ["python", ".\\stemgen.py", full_path, "-d", "cuda", "-f", "aac"]

    # Exécuter la commande
    subprocess.run(cmd)

print("Tous les fichiers ont été traités!")

It will search for flac files in / sources and encoded the final stem files in aac, you can izy tweak it