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

[Feature Request] Windows Support #17

Closed axeldelafosse closed 1 year ago

axeldelafosse commented 1 year ago

Some of my friends are using Windows and I'd love to let them use Stemgen. It should be pretty easy to support but I haven't tried it yet.

benjaminlewandowski commented 1 year ago

most likely this would involve moving from a shell to a python script (as this is platform independent), right?

axeldelafosse commented 1 year ago

Yeah!

kartguru commented 1 year ago

disclaimer: I am by no means a dev, just a hack with a little persistence on my side

I have been absent for a while (sorry as I was going to work on traktor4 metadata) but my notes were along the lines of ...

install wsl (https://learn.microsoft.com/en-us/windows/wsl/install). another contributor in a stem related repository hinted on wsl and it makes life much easier.

install brew
sudo apt install build-essential procps curl file git -y
git clone https://github.com/Homebrew/brew homebrew

eval "$(homebrew/bin/brew shellenv)"
export PATH="/homebrew/bin:$PATH"

eval $(/homebrew/bin/brew shellenv)

git clone https://github.com/axeldelafosse/stemgen.git

brew install coreutils ffmpeg sox jo imagemagick
brew install ffmpeg
brew install imagemagick
brew install sox
brew install jo
brew install mp4box

pip install demucs

brew install mutagen-io/mutagen/mutagen

my notes get sketchy here. had to get back to python 3.9 for demucs i think.

export PATH="/home/USER/homebrew/bin:$PATH" && brew unlink python@3.9 && brew unlink python@3.11 && brew link python@3.9 && sudo mount -t drvfs D: /mnt/d

then running stemgen commands

from memory when trying to create stems on mounted drive I seemed to have trouble with ni-stem erring out when compiling the stem.mp4.

hope this helps. there's definitely an easier way to get it running on windows these days especially if you have some solid dev skills

axeldelafosse commented 1 year ago

Thanks for sharing this @kartguru. Using WSL is a good workaround indeed!

axeldelafosse commented 1 year ago

Good news! I've successfully completed the rewrite of the script in Python: https://github.com/axeldelafosse/stemgen/commit/ed39090cd565a59d8017968630db575a0a6fe81b. Everything is working and I was able to improve the metadata scraping.

I'm gonna work on Windows support tomorrow. Have a good weekend!

axeldelafosse commented 1 year ago

Woohoo! Windows is now supported! You can create ALAC stems and high quality AAC (if you install qaac) directly from your PC.

PS: it looks like ALAC stems are not supported by Traktor on Windows but I'm currently voicing this issue to Native Instruments.

benjaminlewandowski commented 1 year ago

i've had one problem with the windows version: i first had to install soundfile via pip because without it crashed while running demucs. maybe add this command also to the (windows) install guide: pip install soundfile

also: running the script with cuda enabled (in this case changing "-d", "cpu" to "-d", "cuda") did decrease the rendering time from demucs massively on my machine from ~ 30.5seconds/s vs ~ 1seconds/s (i7-10875H; 32gb ram; win 11; python 3.9; geforce 3070 m) - i don't even want to compare the time to my 2017 macbook pro which is even slower.

awesomer commented 1 year ago

FTR, I confirm that ALAC stems are not supported by Traktor 3 on Windows 10. I wonder if it might be supported by old versions of Traktor 2, but am doubtful? I am pretty confident NI is not going to spend the money required to (re-?) license ALAC in order to support ALAC Stems on Windows in current Traktor. I did some hacking/testing and FLAC stems are also not supported, which seems stupid because some forms of the M4A/MP4 container "should" be "able" to support it, see : https://trac.ffmpeg.org/ticket/9311

NI almost certainly doesn't care about anyone trying to use lossless stems (with any codec) on Windows in 2023 (or ever) because if they did, they probably would have just used MKV as a container for stems, which would allow them to produce stems containing FLAC, MP3, AAC or pretty much anything else (except maybe ALAC? google is unclear). The reality is that almost no one cares about using lossless-yet-compressed music for DJing (the people I know who use lossless for DJing use AIFF or WAV (blech!), and even fewer people did back in 2015. Sigh.

benjaminlewandowski commented 1 year ago

would it be a good idea to default to acc if script runs in windows or Linux (as the file will most likely be used in a windows version)? @axeldelafosse

axeldelafosse commented 1 year ago

I am pretty confident NI is not going to spend the money required to (re-?) license ALAC in order to support ALAC Stems on Windows in current Traktor

Do you think that they need a license? ALAC is open source and I think anyone can use it for free.

NI almost certainly doesn't care about anyone trying to use lossless stems (with any codec) on Windows in 2023 (or ever)

I'm not sure about this. We need to push! Actually -- I worked on Windows support to help François K to create lossless stems. He's a legend and I'm pretty sure NI will listen if we show that the community is actively using Traktor Stems. I reached out to the lead product manager and I'm waiting for an answer.

would it be a good idea to default to acc if script runs in windows or Linux

I don't think so. If NI keeps getting feedback that people want lossless stems on Windows, they will probably listen. Also, I'm running Stemgen on Linux (on my home server in Docker) to generate my stems that I use on macOS. And the AAC encoder in Linux is not the best...