Skip to content

1.2 API server

Augusto Bennemann edited this page Sep 23, 2018 · 16 revisions

These instructions are for setting up the API server, which receives requests and process the audio files.

First, follow these instructions to add kxstudio repositories to your system.

Install some required applications:

sudo apt-get update && sudo apt-get install jack jack-tools guitarix python3-pip make sox pkg-config help2man libjack-jackd2-dev lame libsox3 jack-capture libsndfile1-dev opus-tools xauth xbase-clients dbus-x11 ffmpeg ruby fluidsynth

Install some python dependencies:

pip3 install nclib JACK-Client

Install some ruby dependencies:

sudo gem install midilib

Install node.js (you could do it with nvm too):

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Clone the repository

git clone --recurse-submodules [email protected]:gutobenn/musical-artifacts-preview.git

Compile file2jack

cd musical-artifacts-preview/server/jack-file
make

Install js dependencies:

cd ..
npm install

Build database

Manage_artifacts.py is a utility to manage the artifacts database. With 'createdb' parameter the sqlite database is created, and with 'update' all the guitarix artifacts available on musical-artifacts.com are downloaded and configured.

cd scripts
python3 manage_artifacts.py createdb
python3 manage_artifacts.py update

Open guitarix

Run guitarix -N and then close it (ignore any jack error message). It's needed to create the .config/guitarix directory on your machine.

Add a cronjob to regularly update the artifacts database

Run crontab -e. In the editor that opens, add the following. Make sure the path to manage_artifacts.py is correct.

0 */6 * * * python3 /home/ubuntu/musical-artifacts-preview/server/scripts/manage_artifacts.py update_guitarix
0 */9 * * * python3 /home/ubuntu/musical-artifacts-preview/server/scripts/manage_artifacts.py update_soundfonts

Adjust your server URL on server/app.js

Reboot your machine

Ready! Start it

npm start

python3 scripts/start_stop_services.py start to start Guitarix and Jack. To stop them later you can do python3 scripts/start_stop_services.py stop.

Clone this wiki locally