User Tools

This is an old revision of the document!


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.

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 vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities

As you can see, my CPU supports AVX and AVX2.

Then create the usual dedicated user:

useradd -m -d /data/daemons/audiomuse-ai audiomuse-ai

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/daemons/audiomuse-ai/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/daemons/audiomuse-ai/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/daemons/audiomuse-ai/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/daemons/audiomuse-ai/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.

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