MySpleeter is Mac GUI version of Spleeter. MySpleeter allows you to separate any stereo music files into 5stems(vocals/drums/bass/piano/other).
Currently MySpleeter does not support M1 Mac nor M2 Mac. You can check current status on : #8
https://github.com/kyab/MySpleeter/releases/download/20200904_2/MySpleeter20200904.dmg
In this section, I wrote down the way to embed whole spleeter into mac application. (I've basically refered stackoverflow post as a starting point. It describes way to embed python into application.)
brew install openssl
this openssl will be used to static link openssl to self builded python.
Download source code of Python3.7.x from here, then extract it to any place(example : ~/work/python3.7) Python3.8.x does not work with spleeter.
Open file named ~/work/python3.7/Modules/Setup with editor, and edit
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
#_ssl _ssl.c \
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
# -L$(SSL)/lib -lssl -lcrypto
to below
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/opt/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
$(SSL)/lib/libssl.a $(SSL)/lib/libcrypto.a
Then cd to ~/work/python3.7 and build python3.7.x
./configure --prefix="~/work/devbuild" --with-openssl=/usr/local/opt/openssl
make
make install
Execute following commands to install spleeter in self builded python.
cd ~/work/devbuild/bin
export PYTHONPATH="~/work/devbuild/lib/python3.7/site-packages"
./python3 -m pip install spleeter
Now your python build(~/work/devbuild) are spleeter installed version.
Drag and drop ~/work/devbuild into left side (project)view of Xcode.
Drag and drop ~/work/devbuild/lib/libpython3.7m.a into leftside (project)view of Xcode.
In XCode, open project's "Build Phases" tab and add "devbuild" to "Copy Bundle Resources" phase.
Download standalone version of ffmpeg/ffprobe binary(executable) from here.
Create folder named "ffmpeg" in Xcode project and drag and drop ffmpeg/ffprobe binary into left side (project)view of Xcode.
In XCode, open project's "Build Phases" tab and add "devbuild" to "Copy Bundle Resouces" phase.
At first, path to ffmpeg/ffprobe should be in PATH environment value when your application launch. See code around
MySpleeter/MySpleeter/SpleeterWrapper.m
Line 23 in a33ecf7
Next, PYTHONPATH should be set, for embedded python can find spleeter and dependent python libraries. See code around
MySpleeter/MySpleeter/SpleeterWrapper.m
Line 32 in a33ecf7
After that, Initializing python from C should success.
Using Python's C API to call spleeter API that written in Python. See code started from here(
MySpleeter/MySpleeter/SpleeterWrapper.m
Line 107 in a33ecf7
MySpleeter/MySpleeter/SpleeterWrapper.m
Line 132 in a33ecf7
If you successfully build, try run your application on fresh installed macOS. It would ensure that can run without any preinstalled modules, if you plan to distribute your app.