Code Monkey home page Code Monkey logo

stemgen's Introduction

πŸŽ› Stemgen

Stemgen is a Stem file generator. Convert any track into a Stem and have fun with Traktor.

A Stem file is an open, multi-channel audio file that contains a track split into four musical elements – bass, drums, vocals, and melody, for example. With each element available independently, you have more control over the music you play.

Stemgen uses demucs to separate the 4 stems and ni-stem to create the Stem file.

Screenshot Before Screenshot After

Our new file contains four stems: drums, bass, other (melody) and vocals.

Why?

"It's no secret that I'm fully behind the approach to encourage individuality in creativity and for artists to play differently. Stems is a new format that mirrors my constant quest for spontaneity to drive the art of performance forwards. I hope that releasing my album From My Mind To Yours in this format, mastered by LANDR, inspires others to support the approach and bring even more flexibility to the art of DJing amongst its most progressive supporters." – Richie Hawtin

Stems are fun but nobody's releasing them. Stemgen is a way to create your own stems with only one command.

May 2023 Update: I saw François K last week in Paris at the Loft Babies party and I discovered that he's playing with Stems. I highly recommend checking out his videos on YouTube: https://www.youtube.com/playlist?list=PLCr4LSsJFk48tmNoKn-l7mgsB5XUd2Af9. He's a legend and a true pioneer. I'm so happy to see him having fun with Stems. And trust me: it's even better in real life. Can't wait to see him again!

"There is a really big difference between using a tool, a computer as a tool, to make it do specific things we want it to do, in the manner in which we want it to accomplish it. In most other situations, we all find ourselves dealing with a pre-programmed or pre-determined path that the software designer has decided we must use the software in order to get certain things done. And I think that makes it that we, little by little, become controlled by the path that was designed by the people who wrote the software and forced into these gullies that they created of usage, that this is how we are supposed to be doing things. And after a while I think it's making us forget who we were and what the essence of what the music was supposed to be about and really represented.

And this right here -- I have to be honest -- it's groundbreaking to me in that sense. It's putting me back in touch with using these tools that I'm using right now as mere instruments of my will, rather than me being forced around the way they were designed to be operated, and in the process losing the very essence of what I was trying to express. Goddammit!" – FranΓ§ois K, Expansions (Live Stems Dub and Talk)

What?

  • Highest quality: ALAC stems by default, or AAC using the best encoder and quality possible.
  • Automatic metadata tagging: scraping metadata from the master file and writing it back to the stem file.
  • Batching: you can use this CLI to batch your stem creation and/or create a powerful workflow.
  • Universal: works on macOS, Windows and Linux.

Requirement

Usage

You can use stemgen.py to generate stems:

  • $ python3 stemgen.py track.wav
  • Have fun! Your new .stem.m4a file is in output dir
  • Supported input file format are .wav .wave .aif .aiff .flac

Running Stemgen with Docker

To avoid having to install dependencies manually, you can run stemgen with docker:

scripts/run_stemgen_with_docker.sh /path/to/track.wav`

Bring your own stems

Manually

You can use stem.py to create stems:

  • $ python3 stem.py -i track/track.0.wav
  • You need to follow this naming convention: [TRACK_NAME].[TRACK_NUMBER].[FILE_EXTENSION]
  • TRACK_NAME should be identical for all files
  • Please use 0 as the TRACK_NUMBER for the master track. Example: 'track.0.wav' for the master file then 'track.1.wav' for the first stem, etc...
  • Have fun! Your new .stem.m4a file is in output dir
  • Supported input file format are .wav .wave .aif .aiff .flac

With Ableton Live

You can use Ableton Live to create stems:

  • $ python3 ableton.py

Quick install on macOS

  • python3 -m pip install -U demucs
  • python3 -m pip install mutagen
  • brew install coreutils ffmpeg sox

Quick install on Linux

Long install on Windows

qaac

If you plan to encode in AAC, you should install qaac. Here is a quick guide:

Then, to use Audio Toolbox from Apple:

  • git clone https://github.com/nu774/makeportable.git
  • cd makeportable
  • Download the iTunes installer from https://www.apple.com/itunes/download/win64
  • Copy the iTunes installer to the makeportable folder
  • makeportable.cmd
  • Copy the newly created folder QTfiles64 to your C:\Program Files\qaac folder

Then, to support FLAC files:

  • Download FLAC from https://github.com/xiph/flac/releases
  • Copy the libFLAC.dll file from the Win64 folder (or Win32 depending on your system)
  • Paste it in your C:\Program Files\qaac folder

Enjoy! You can now encode AAC stems with Apple Audio Toolbox, the highest quality AAC encoder.

Performance

  • Stem and Stemgen supports 16-bit and 24-bit audio files!
  • Stemgen needs to downsample the track to 44.1kHz to avoid problems with the separation software because the models are trained on 44.1kHz audio files. Stem uses the original sample rate.
  • You may notice that the output file is pretty big. Apple Lossless Codec (ALAC) for audio encoding is used for lossless audio compression at the cost of increased file size.

Screenshot Input Screenshot Output

Disclaimer

If you plan to use Stemgen on copyrighted material, make sure you get proper authorization from right owners beforehand.

License

MIT

stemgen's People

Contributors

axeldelafosse avatar fontanierh avatar jackhunt avatar ma5onic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stemgen's Issues

[Feature Request] Following the Stem File Specification

Is there a reason that you aren't following the stem file specification and using M4A instead of MP4?
I marked this as a feature request, but I've never seen a stem file using m4a. To my understanding, the only difference between the two is the file extension, the file contents are the same.

According to NI's Programmers' Reference:

There are two criteria every Stem File must fulfillβ€”failure to fulfill these criteria means the file
in question is not a Stem File:
β–ͺ The file must be a valid MP4 file (ISO base media file format: ISO/IEC 14496-12) with the
    β€œ.mp4” file extension. Preferably the file name should end with β€œ.stem.mp4”, but just
    β€œ.mp4” is also valid.
β–ͺ The MP4 file must contain a box (i.e. data container) of type stem as a sub-box of
moov.udta. moov is the root box of the MP4 file, as shown in the Stem File Structure
diagram in section ↑7.1, File Structure.

Stem File Specification English.pdf

[Bug] Windows cleaning step failing

I always get this error on different windows install:

[Done 6/6]

creating E:\Users\Rouniald\Music\stemgen-master\.\output/Olmatri - Kaspar/Olmatri - Kaspar.stem.m4a was successful!
Done.
Cleaning...
Traceback (most recent call last):
  File "E:\Users\Rouniald\Music\stemgen-master\stemgen.py", line 427, in <module>
    main()
  File "E:\Users\Rouniald\Music\stemgen-master\stemgen.py", line 422, in main
    run()
  File "E:\Users\Rouniald\Music\stemgen-master\stemgen.py", line 302, in run
    clean_dir()
  File "E:\Users\Rouniald\Music\stemgen-master\stemgen.py", line 415, in clean_dir
    shutil.rmtree(os.path.join(OUTPUT_PATH + "/" + FILE_NAME))
  File "C:\Users\rouniald\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rouniald\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 626, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\Users\rouniald\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 624, in _rmtree_unsafe
    os.rmdir(path)
PermissionError: [WinError 32] Le processus ne peut pas accΓ©der au fichier car ce fichier est utilisΓ© par un autre processus: 'E:\\Users\\Rouniald\\Music\\stemgen-master\\.\\output/Olmatri - Kaspar'

demucs support proof of concept patch

Hi there! First of all, love stemgen and think it gives new life to the otherwise pretty dead NI stems format.

I've created a proof of concept kludge patch that shows that it can work with Facebook's "demucs" project, which has better separation results than spleeter and is also significantly easier to get running :

https://github.com/facebookresearch/demucs/

I've attached the proof of concept .patch file with a .txt extension so that github will allow it. As a proof of concept, it's not of sufficient quality to bother submitting it as a pull request. Ideally you could use the information contained within to modify stemgen to support both spleeter and demucs.

A notable caveat is that demucs' output always includes the model name and this cannot be modified via commandline options to demucs. That's why the paths look so ugly in this patch.

Thanks again and hope you find this informative and/or useful.

stemgen.patch.txt

[Feature request] Custom name & color for stem

I would like to customize the name & color of the different stem, is it possible? My goal is to include the key of each stem by running libkeyfinder from mixxxdj just after stem separation. I can modify the code myself to include libkeyfinder, but can't find a way for custom naming & Would find nice to set custom color to the different stem with hex cli option.

[Feature Request] Windows Support

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.

GPU Support?

Since Demucs has GPU Support, Do you plan on adding it to this tool? Do you already have a way and just undocumented?

Bug: Incorrect handling of sampling rate of input file

I change the stemgen file so that I can convert mp3 files. When doing so I found out that the stems created are sped up due to the sample rate of my input mp3 being higher than 44100. (I'm surprised that it doesn't cause a slowdown instead tbh).

Not sure if other formats have the same issue so didn't want to put up a pull request before figuring that out.

Solution for me was quite simple: Convert files with ffmped with -ar 44100 flag to convert the input file correctly.

mp3 processing

Hi, This is a nice project. I was exploring it because I need to create some stems and I'm too lazy to make them by hand. When I executed the .py file, I received a message in console that says that I must to use other audio file format instead of mp3. Why I can't use mp3?

If we can't use, I think I'll be useful convert the input if the format file is mp3.

Extract audio files from STEM file?

I downloaded the 65 free stems from NI that they provide, and they're 65 .mp4 files, each containing the stems

Is there a way to extract the stems from those containers? StemGen does the opposite

[Feature Request] traktor4 metadata

In the metadata extract you can see a traktor4 tag is extracted and written to the metadata.txt file. I found a page outlining it's contents here - Decoding the traktor4 field.

Can you see any complications in having the converted stems file using the original traktor4 tags? If not, are you able to copy the source traktor4 tags to the newly created stems file? Thanks for considering @axeldelafosse

Getting an error, when running the docker script version.

Everything is fine and files are being created, but on the last step, (After 'Done 5/6' log)
I get the following error message:
/stemgen/ni-stem/GPAC_linux/MP4Box: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

The environment is WSL2 on Windows 11

Google Colab version?

Have you tried running this on Google colab or have a notebook available?

Demucs cooks my laptop, and I noticed they had a colab available. Then while looking for a library to convert the output to Traktor's stem files, I ran across this repo. Is ni-stems a library you wrote?

upgrade demucs version to v4 and htdemucs/htdemucs_ft model

The v4 version features Hybrid Transformer Demucs, a hybrid spectrogram/waveform separation model using Transformers. It is based on Hybrid Demucs (also provided in this repo) with the innermost layers are replaced by a cross-domain Transformer Encoder. This Transformer uses self-attention within each domain, and cross-attention across domains. The model achieves a SDR of 9.00 dB on the MUSDB HQ test set. Moreover, when using sparse attention kernels to extend its receptive field and per source fine-tuning, we achieve state-of-the-art 9.20 dB of SDR.

Since v3 demucs was 7.7dB of SDR, this upgrade seems as significant an improvement as the one from Spleeter (5.9dB) to v3 demucs (7.7dB). Anecdotally, it sounds awesome. Patch should be very easy, but I'm not sure how to enforce v4 of the demucs library, or whether you prefer htdemucs or the much-slower-but-better htdemucs_ft.

[No such file or directory] \output/NoGoodbye/htdemucs/NoGoodbye/drums.wav

INFORMATION

OS: Windows 10
Running In: Powershell
Command: python stemgen.py -i NoGoodbye.flac

MORE

I've install all requirements. It starts converting \output/NoGoodbye/htdemucs/NoGoodbye/drums.wav to ALAC and I get the following error: C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/htdemucs/NoGoodbye/drums.wav: No such file or directory.
FLAC file plays fine.

LOG

Using CPU for processing.
Output dir already exists.
Working dir created.
Done.
Extracting bit depth...
bits_per_sample=16
Done.
Extracting sample rate...
sample_rate=44100
Done.
Extracting cover...
ffmpeg version 2023-04-12-git-1179bb703e-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60.  9.100 / 60.  9.100
  libavformat    60.  4.101 / 60.  4.101
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  5.100 /  9.  5.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, flac, from 'C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/NoGoodbye.flac':
  Metadata:
    TITLE           : No Goodbye
    ARTIST          : Paul Kalkbrenner
    ALBUM           : No Goodbye
    YEAR            : 2019
    DATE            : 2019-07-26
  Duration: 00:06:30.92, start: 0.000000, bitrate: 840 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
  Stream #0:1: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 500x500 [SAR 300:300 DAR 1:1], 90k tbr, 90k tbn (attached pic)
    Metadata:
      comment         : Cover (front)
Output #0, image2, to 'C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/cover.jpg':
  Metadata:
    TITLE           : No Goodbye
    ARTIST          : Paul Kalkbrenner
    ALBUM           : No Goodbye
    YEAR            : 2019
    DATE            : 2019-07-26
    encoder         : Lavf60.4.101
  Stream #0:0: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 500x500 [SAR 300:300 DAR 1:1], q=2-31, 90k tbr, 90k tbn (attached pic)
    Metadata:
      comment         : Cover (front)
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
[image2 @ 000001dd017d18c0] The specified filename 'C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/cover.jpg' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 000001dd017d18c0] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
frame=    1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x
video:42kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Cover extracted with ffmpeg.
Done.
Extracting metadata...
TITLE=No Goodbye
ARTIST=Paul Kalkbrenner
ALBUM=No Goodbye
YEAR=2019
DATE=2019-07-26
{'title': 'No Goodbye', 'artist': 'Paul Kalkbrenner', 'album': 'No Goodbye', 'year': '2019-07-26', 'cover': 'C:\\Users\\NZXT\\Downloads\\stemgen-master\\output\\NoGoodbye\\cover.jpg'}
Creating tags.json...
Done.
Converting to wav and/or downsampling...

Input File     : 'C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/NoGoodbye.flac'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:06:30.92 = 17239572 samples = 29319 CDDA sectors
File Size      : 41.0M
Bit Rate       : 840k
Sample Encoding: 16-bit FLAC
Comments       :
TITLE=No Goodbye
ARTIST=Paul Kalkbrenner
ALBUM=No Goodbye
YEAR=2019
DATE=2019-07-26

In:100%  00:06:30.92 [00:00:00.00] Out:17.2M [!=====|=====!] Hd:0.1 Clip:0
Done.
Done.
Ready!
Creating a Stem file for NoGoodbye...
Splitting stems...
Using 16-bit model...
Selected model is a bag of 1 models. You will see that many progress bars per track.
Separated tracks will be stored in C:\Users\NZXT\Downloads\stemgen-master\output\NoGoodbye\htdemucs
Separating track C:\Users\NZXT\Downloads\stemgen-master\output\NoGoodbye\NoGoodbye.flac
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 391.95/391.95 [04:37<00:00,  1.41seconds/s]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\NZXT\AppData\Local\Programs\Python\Python311\Lib\site-packages\demucs\__main__.py", line 10, in <module>
    main()
  File "C:\Users\NZXT\AppData\Local\Programs\Python\Python311\Lib\site-packages\demucs\separate.py", line 199, in main
    save_audio(source, str(stem), **kwargs)
  File "C:\Users\NZXT\AppData\Local\Programs\Python\Python311\Lib\site-packages\demucs\audio.py", line 260, in save_audio
    ta.save(str(path), wav, sample_rate=samplerate,
  File "C:\Users\NZXT\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchaudio\_backend\utils.py", line 312, in save
    backend = dispatcher(uri, format, backend)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\NZXT\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchaudio\_backend\utils.py", line 222, in dispatcher
    raise RuntimeError(f"Couldn't find appropriate backend to handle uri {uri} and format {format}.")
RuntimeError: Couldn't find appropriate backend to handle uri C:\Users\NZXT\Downloads\stemgen-master\output\NoGoodbye\htdemucs\NoGoodbye\drums.wav and format None.
Done.
Creating stem...

[Done 0/6]


converting C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/NoGoodbye.wav to alac...
ffmpeg version 2023-04-12-git-1179bb703e-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60.  9.100 / 60.  9.100
  libavformat    60.  4.101 / 60.  4.101
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  5.100 /  9.  5.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[aist#0:0/pcm_s16le @ 0000023e1c4a6b80] Guessed Channel Layout: stereo
Input #0, wav, from 'C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/NoGoodbye.wav':
  Duration: 00:06:30.92, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> alac (native))
Press [q] to stop, [?] for help
Output #0, ipod, to 'C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/NoGoodbye.m4a':
  Metadata:
    encoder         : Lavf60.4.101
  Stream #0:0: Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc60.9.100 alac
size=   40218kB time=00:06:30.83 bitrate= 843.0kbits/s speed= 107x
video:0kB audio:40201kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.044139%

[Done 1/6]


converting C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/htdemucs/NoGoodbye/drums.wav to alac...
ffmpeg version 2023-04-12-git-1179bb703e-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58.  6.100 / 58.  6.100
  libavcodec     60.  9.100 / 60.  9.100
  libavformat    60.  4.101 / 60.  4.101
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  5.100 /  9.  5.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
C:\Users\NZXT\Downloads\stemgen-master\output/NoGoodbye/htdemucs/NoGoodbye/drums.wav: No such file or directory
Command '['ffmpeg', '-i', 'C:\\Users\\NZXT\\Downloads\\stemgen-master\\output/NoGoodbye/htdemucs/NoGoodbye/drums.wav', '-c:a', 'alac', '-c:v', 'copy', 'C:\\Users\\NZXT\\Downloads\\stemgen-master\\output/NoGoodbye/htdemucs/NoGoodbye/drums.m4a']' returned non-zero exit status 1.
Done.
Cleaning...
Done.
Success! Have fun :)

Processing without a metadata file as an input

I'm trying to make sure I'm not going crazy and missing the obvious but in ni-stem.py:

   metaData = []
   if metadataFile:
      fileObj = codecs.open(metadataFile, encoding="utf-8")
      try:
         metaData = json.load(fileObj)
      except IOError:
         raise
      except Exception as e:
         raise RuntimeError("Error while reading metadata file")
      finally:
         fileObj.close()

   numStems = len(stemTracks)
   numMetaEntries = len(metaData["stems"])

if no metataFile is passed, metaData is a list which means metaData["stems"] can't' work right?

Similar thing with _defaultMetadata which is just a list of stem metadata entries but is also accessed with:

self._defaultMetadata["stems"]

which also seems like it can't work.

Am I missing something or is everyone passing a metadata file when converting and therefore missing those bugs?

Thanks!

Mutagen missing in installation instructions

I followed the installation instructions for Mac, and when trying to create a stemgen python3 complained about missing mutagen package.
Installation of this should be reflected in the installation instructions, e.g.:
python3 -m pip install -U demucs mutagen

Generated file has wrong file extension .stem.m4a instead of .stem.mp4

A STEM file must have the suffix .stem.mp4, but stemgen generates the file with the extension .stem.m4a.

Traktor Pro seems not to care for the file extension and loads it anyway, but for other tools it makes a difference. The .mp4 extension is selected by Native Instruments, because any MP4 decoder will play the master track with all stems mixed when the file is loaded.

How to know if qaac encoder is used on Windows?

The log make me think that maybe it's not the freshly installed qaac encoder that is being used:

Input #0, wav, from 'output/Kokoroko - Abusey Junction/Kokoroko - Abusey Junction.wav':
  Duration: 00:07:09.11, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, ipod, to 'output/Kokoroko - Abusey Junction/Kokoroko - Abusey Junction.m4a':
  Metadata:
    encoder         : Lavf60.10.101
  Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.23.100 aac
size=    1024kB time=00:01:14.55 bitrate= 112.5kbits/s speed=29.8x

ni-stem errors on linux

I'm trying to use stemgen to separate stems for a .flac file on debian 11 but near the end of ni-stem it outputs the following:

[Done 5/6]

expected str, bytes or os.PathLike object, not NoneType
Done.
Cleaning...
Error.

ni-stem not working

I can't get this to work since the move to python3
running this manually I'm getting the following:
./ni-stem create -x "./INPUT/master.wav" -s "./INPUT/drums.wav" "./INPUT/bass.wav" "./INPUT/other.wav" "./INPUT/vocals.wav"
list indices must be integers or slices, not str

Installation Instructions

Looks promising but is there any chance you could write some installation instructions for the novices out there ;)

Cheers

[Note] ALAC stems can't be read on Windows within Traktor

I wanted to create an issue here to document the fact that Traktor does not currently support ALAC stems on windows despite NI being the creator of the stem spec.

See: https://community.native-instruments.com/discussion/13298/lossless-stems-on-windows

While this is not actually in issue with Stemgen, it is probably a bug that many users of this tool will face. So be aware of this issue before you submit a bug report to Stemgen and upvote the issue above if possible.

Error opening input: No such file or directory

Ive running into following error after the first step is done. looks like there is something wrong with ffmpeg?!

[Done 1/6]
converting output/test/htdemucs/test/drums.wav to alac...
ffmpeg version 2023-08-23-git-5f5a1ccd04-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 58. 17.100 / 58. 17.100
libavcodec 60. 23.100 / 60. 23.100
libavformat 60. 10.100 / 60. 10.100
libavdevice 60. 2.101 / 60. 2.101
libavfilter 9. 11.100 / 9. 11.100
libswscale 7. 3.100 / 7. 3.100
libswresample 4. 11.100 / 4. 11.100
libpostproc 57. 2.100 / 57. 2.100
[in#0 @ 0000014809e77340] Error opening input: No such file or directory
Error opening input file output/test/htdemucs/test/drums.wav.
Error opening input files: No such file or directory
Command '['ffmpeg', '-i', 'output/test/htdemucs/test/drums.wav', '-c:a', 'alac', '-c:v', 'copy', 'output/test/htdemucs/test/drums.m4a']' returned non-zero exit status 4294967294.
Done.
Cleaning...
Traceback (most recent call last):
File "C:\stemgen\stemgen.py", line 405, in
run()
File "C:\stemgen\stemgen.py", line 287, in run
clean_dir()
File "C:\stemgen\stemgen.py", line 394, in clean_dir
shutil.rmtree(os.path.join(DIR, OUTPUT_PATH + "/" + FILE_NAME))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64__qbz5n2kfra8p0\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64__qbz5n2kfra8p0\Lib\shutil.py", line 626, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64__qbz5n2kfra8p0\Lib\shutil.py", line 624, in _rmtree_unsafe
os.rmdir(path)
PermissionError: [WinError 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'C:\stemgen\output/test'

Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird
The process cannot access the file because it is used by another process

But there is no other process. Someone can help here?

Greetings

[Feature Request] GUI

I just discovered RipX and I have to admit: having a nice GUI would be a cool addition. It would be even better if it was a web app!

Converting multiple songs at once?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.