Closed 0x213F closed 3 years ago
Reiterating the important part here, and clarifying it a bit more:
Before working on this ticket, you should run:
docker-compose -f local_worker.yml build
Then, you should run Docker in the background in your new container:
docker-compose -f local_worker.yml up
Navigate to the local instance. Upload a file. You can use the same account that you were using for local.yml
since they share a database.
Once there is an audio file in the database, you can run the management command in a new terminal tab (make sure the server is still running):
docker-compose -f local_worker.yml run --rm django python manage.py generate_stems
Which, tada, will run the generate_stems
code. Inside that code is where this ticket should be implemented. The stack trace of the code which is run inside the management command happens in the server terminal GUI.
@room20b my apologies, but for the time being this ticket is no longer needed. If you happen to have written some code and are attached to it, let's have a conversation. Otherwise, you can scrap this.
Closing.
Background
There is a ML package called Spleeter which separates an audio file into stems. It might be a little hard to find the Python guide, so here it is linked for your convenience.
0x213F added Spleeter to the codebase and a background task processed audio uploads, automatically separating every single upload into stems. After deploying this to production, it was immediately clear that the hardware could not handle a task this large. As such, the feature was scrapped.
When building the project, one can build it using
local.yml
for local development orproduction.yml
for a production environment.When building the project with Spleeter integration, one can build it using
local_worker.yml
for local development orproduction_worker.yml
for a production environment. In order to generate stems, after building the project (and running the container, Redis must be on!) just run this command:Summary
The stem separation script is right here:
https://github.com/0x213F/jukebox-radio-django/blob/main/jukebox_radio/music/tasks.py
(By the way, you're going to want to uncomment that file when generating stems)
In the script, it creates 4 stems:
Request
The script should create 4 more stems:
In order to support this change, there will need to be 4 other instrument choices added to the Stem model.
muted_drums
muted_vocals
muted_bass
muted_other
The generate stems script should merge together the audio files to actually create these stems and save them to the database.