/music-remover

Removes the music from an audio file, so that only the voices remain

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

๐Ÿ”‡ Music remover
๐Ÿšง (WIP) ๐Ÿšง


โ„น๏ธ Description

Removes the music from an audio file, so that only the voices remain.

This API was built for Moubah.


๐Ÿ’ป Tech Stack:

Python gRPC


๐Ÿ”— Prerequisite


๐Ÿ”ง Setup

On Windows: use .exe (PowerShell recommended)

On Mac with Apple chip: use arch -x86_64 at the beginning of the command when indicated

Check that Python3.8 is correctly installed:

python3.8 --version

You may just have to use python.exe --version, without 3.8 on Windows


If you came from Moubah, make sure that the submodule is correctly imported:

git submodule update --init

Otherwise, just clone the repo:

git clone git@github.com:karim-bouchez/music-remover.git

And make sure you are in the music-remover directory:

pwd

Create and active a virtual environment:

# On UNIX OS:
python3.8 -m venv .venv
source .venv/bin/activate

# On Windows OS:
python3.8.exe -m venv .venv
.\.venv\Scripts\Activate.ps1

Upgrade pip:

[arch -x86_64] python[.exe] -m pip install --upgrade pip

If ModuleNotFoundError: No module named 'pip' error --> run python[.exe] -m ensurepip


Download 3rd party dependencies:

python[.exe] -m pip install requests
python[.exe] download_3rd_party_deps.py

If No such file or directory error --> run git submodule update --init


Install Spleeter manually:

  • for Mac with Apple silicon:
arch -x86_64 python -m pip install --upgrade spleeter-2.3.0b0-cp38-cp38-macosx_11_0_x86_64.whl
  • for other platforms:
python[.exe] -m pip install spleeter

Install other libraries:

[arch -x86_64] python[.exe] -m pip install -r requirements.txt

Generate gRPC code: TODO karim: store these files in Github and move this command in ~ "Contribution"

[arch -x86_64] python[.exe] -m grpc_tools.protoc --proto_path=src/protobuf --python_out=. --grpc_python_out=. src/protobuf/moubah.proto

๐Ÿ Run it with Python

[arch -x86_64] python[.exe] app.py --host localhost --port 46471

๐Ÿš€ Test it with Postman

You can access to the workspace here


๐Ÿ“ฆ Create an executable file

[arch -x86_64] pyinstaller[.exe] app.spec --noconfirm --clean

โ˜„๏ธ Run the executable file

  • on Mac: (no need for arch -x86_64) (not working right now)
./dist/app/app --host localhost --port 46471

Apple Silicon: the executable file doesn't currently work
Error thrown:

malloc: Incorrect checksum for freed object 0x7f7a43d24280: probably modified after being freed.
malloc: *** set a breakpoint in malloc_error_break to debug
  • on Windows:
.\dist\music-remover.exe --host localhost --port 46471

๐ŸŽฏ To-do list

  • ๐Ÿ†• fake a first request to avoid cold start and so the real first request is quick
  • ๐Ÿงผ Clean: use strict version from spleeter
  • ๐Ÿ†• Feature: add progress status or infos on downloading 3rd party