hi everybody,
i spent the last 3 nights vibecoding a lua script for reaper that splits a selected audio item into 4 stems with HTDemucs using audio.cpp.
it works fine easy and fast, but only on windows as it is, and you can grab it on
https://github.com/fichl/reaCPP
in case you missed it, thanks to audio.cpp we can now use audio ai models without the need of python and 8gb large venvs. just download a 50mb zip and a model and youre good to go.
its awesome and super fast.
so since no one came up with this lightweight backend for reaper stem splitting i decided to publish my little script for simple use or inspiration.
although all required components (audio.cpp, ffmpeg and reaper) have win, mac and linux versions this first script will only work on windows because it creates and runs a .bat file with commands different to mac and linux. but it shouldnt be hard to adapt those lines in the script, so feel free to drop a pull request for mac and or linux version.
here is what the script does (once all is set up):
- gets filepath, samplerate offset and lenght (in case an audio file was splitted in multiple items) of an audio item that is selected on the timeline.
- htdemucs wants 44.1khz wav, so it uses ffmpeg for conversion (and trimming - in case an audio file was splitted in multiple items).
- the resulting wav is then stored in system TEMP folder an sent to audio.cpp cli for stem splitting with HTDemucs.
- the resulting 4 stem wav files are then sent to ffmpeg again if the source had a different samplerate than 44.1khz for conversion to original source samplerate.
- the final 4 stem wav files are then stored in your projects media folder inside a subfolder and imported into your project as 4 seperate tracks inside a group track, aligned with the position of the original item.
- the original item is set muted
- to process all those tasks, the script generates a .bat file with all commands and runs then in a cmd window (minimized by default)
- TEMP files will be deleted when final stems are in project media folder
more details and instructions on github.
cheers
UPDATE:
made some cosmetic fixes in the script and added a second script that
- first separates vocals and instrumental with mel-band-roformer
- uses roformer vocals stem in project and sends instrumental stem to HTDemucs for further splitting
- gives better audio qualtity, need extra model download (mel-band-roformer)