AudioMuse-AI
AudioMuse-AI is AudioMuse-AI is an Open Source environment that brings automatic playlist generation to your self-hosted music library. Using powerful tools like Librosa and ONNX, it performs sonic analysis on your audio files locally, allowing you to curate the perfect playlist for any mood or occasion without relying on external APIs.
This pairs with Navidrome, that you need to have installed.
The AudioMuse-AI developers like you to know that they are not affiliated with, endorsed by, or sponsored by the owners of audiomuse.ai website.
Installation
First of all, AudioMuse-AI requires a CPU with avx support, so check that your hardware fit the bill:
bash ~ # lscpu | grep -i avx Flags: fpu [...] avx [..] avx2 [...] arch_capabilities
As you can see, my CPU supports AVX and AVX2.
Then create the usual dedicated user and data folders for persistency:
useradd -m -d /data/daemons/audiomuse-ai audiomuse-ai mkdir /data/audiomuse mkdir /data/audiomuse/temp_audio mkdir /data/audiomuse/postgres_data chown -R audiomuse-ai:audiomuse-ai /data/audiomuse
and, as user audiomuse-ai, create the docker compose file.
The docker compose file from https://github.com/NeptuneHub/AudioMuse-AI/blob/main/deployment/deployment-navidrome.yaml is really complex and hard to read, and doesn't work with the podman-compose i am using, so, here is the one i have rewritten to make it closer to all the other composers file i use:
- docker-compose.yaml
services: audiomuse-ai: image: ghcr.io/neptunehub/audiomuse-ai:latest container_name: audiomuse-ai ports: - "8925:8000" volumes: - /data/audiomuse/temp_audio:/app/temp_audio environment: MEDIASERVER_TYPE: "navidrome" NAVIDROME_URL: "https://navidrome.mydomain.com" REDIS_URL: "redis://redis:6379/0" TEMP_DIR: "/app/temp_audio" SERVICE_TYPE: "flask" NAVIDROME_USER: "user" NAVIDROME_PASSWORD: "password" POSTGRES_USER: "audiomuse" POSTGRES_PASSWORD: "audiomusepassword" POSTGRES_DB: "audiomusedb" POSTGRES_HOST: "postgres" POSTGRES_PORT: "5432" GEMINI_API_KEY: "your gemini api key" depends_on: - postgres network: - audiomuse-ai-net rq-worker: container_name: audiomuse-ai-worker image: ghcr.io/neptunehub/audiomuse-ai:latest # ports: # - "8925:8000" volumes: - /data/audiomuse/temp_audio:/app/temp_audio environment: MEDIASERVER_TYPE: "navidrome" NAVIDROME_URL: "https://navidrome.mydomain.com" REDIS_URL: "redis://redis:6379/0" TEMP_DIR: "/app/temp_audio" SERVICE_TYPE: "worker" NAVIDROME_USER: "user" NAVIDROME_PASSWORD: "password" POSTGRES_USER: "audiomuse" POSTGRES_PASSWORD: "audiomusepassword" POSTGRES_DB: "audiomusedb" POSTGRES_HOST: "postgres" POSTGRES_HOST: "postgres" POSTGRES_PORT: "5432" GEMINI_API_KEY: "" depends_on: - postgres - redis network: - audiomuse-ai-net postgres: container_name: postgres image: postgres:15-alpine volumes: - /data/audiomuse/postgres_data:/var/lib/postgresql/data environment: SERVICE_TYPE: "flask" NAVIDROME_USER: "willy" NAVIDROME_PASSWORD: "Gargiul01=" POSTGRES_USER: "audiomuse" POSTGRES_PASSWORD: "audiomusepassword" POSTGRES_DB: "audiomusedb" POSTGRES_HOST: "postgres" POSTGRES_PORT: "5432" GEMINI_API_KEY: "" network: - audiomuse-ai-net redis: container_name: redis image: redis:7-alpine volumes: - /data/audiomuse/postgres_data:/var/lib/postgresql/data environment: SERVICE_TYPE: "flask" NAVIDROME_USER: "willy" NAVIDROME_PASSWORD: "Gargiul01=" POSTGRES_USER: "audiomuse" POSTGRES_PASSWORD: "audiomusepassword" POSTGRES_DB: "audiomusedb" POSTGRES_HOST: "postgres" POSTGRES_PORT: "5432" GEMINI_API_KEY: "" network: - audiomuse-ai-net networks: audiomuse-ai-net: dns_enabled: true
Of course, you need to specify your Navidrome URL, user and password. The GEMINI key is not required, only if you want AI assisted playlist naming. You could also use a self-hosted OLLAMA.
Gemini AI usage
If you want to use the capability to create playlists names using AI, you can use Gemini (and others too). Go to Google AI studio page, create a new API key and project, and copy the key itself into the relevant line in the above Docker Compose file.
Reverse Proxy
AudioMuse-ai seems to be working only on subdomain and not on subpath. I assume you have am.mydomain.com. See the F) The Reverse Proxy concept for more details.
- spotizerr.conf
server { server_name am.mydomain.com; listen 443 ssl; http2 on; access_log /var/log/nginx/am.mydomain.com_access_log main; error_log /var/log/nginx/am.mydomain.com_error_log info; location / { proxy_pass http://127.0.0.1:7171/; proxy_set_header Connection $http_connection; proxy_set_header Upgrade $http_upgrade; } include com.mydomain/certbot.conf; } server { server_name am.mydomain.com; listen 8443 ssl; http2 on; access_log /var/log/nginx/am.mydomain.com_access_log main; error_log /var/log/nginx/am.mydomain.com_error_log info; include "com.mydomain/authelia_location.conf"; location / { include "com.mydomain/authelia_proxy.conf"; include "com.mydomain/authelia_authrequest.conf"; proxy_pass http://127.0.0.1:7171/; proxy_set_header Connection $http_connection; proxy_set_header Upgrade $http_upgrade; } include com.mydomain/certbot.conf; }
Please note that AudioMuse-ai does not provide any authentication or protection: you must put your SSO (see here) and HTTPS on top of it using the reverse proxy as in the above config example.
As usual, i have protected with SSO only the external access profile (port 8443).
Autostart
To start it, and set it up on boot, as usual follow my indications Using Containers on Gentoo, so link the user-containers init script:
ln -s /etc/init.d/user-containers /etc/init.d/user-containers.audiomuse-ai
and create the following config file:
- user-containers.audiomuse-ai
USER=audiomuse-ai DESCRIPTION="Music analyzer"
Add the service to the default runlevel and start it now:
/etc/init.d/user-containers.audiomuse-ai start rc-update user-containers.audiomuse-ai