From 5254769a9cd72338a7b2c530545bcb9073ca0068 Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sun, 1 Jun 2025 20:57:07 +0200 Subject: [PATCH 1/2] music/bitvis: Use fastLookaheadLimiter --- roles/music/tasks/bitvis.yaml | 1 + roles/music/templates/pw-bitvis-mixer.conf | 25 ++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/roles/music/tasks/bitvis.yaml b/roles/music/tasks/bitvis.yaml index a0a4ee4..81688b4 100644 --- a/roles/music/tasks/bitvis.yaml +++ b/roles/music/tasks/bitvis.yaml @@ -4,6 +4,7 @@ name: - bitvis - bitvis-http + - swh-plugins - name: Create bitvis user user: diff --git a/roles/music/templates/pw-bitvis-mixer.conf b/roles/music/templates/pw-bitvis-mixer.conf index f1dca3a..c2a98b1 100644 --- a/roles/music/templates/pw-bitvis-mixer.conf +++ b/roles/music/templates/pw-bitvis-mixer.conf @@ -9,17 +9,28 @@ context.modules = [ filter.graph = { nodes = [ { - name = mix - type = builtin - label = mixer + name = normalize + type = ladspa + plugin = fast_lookahead_limiter_1913 + label = fastLookaheadLimiter control = { - "Gain 1" = 10 - "Gain 2" = 10 + "Input gain (dB)" = 40 + "Limit (dB)" = 0 + "Release time (s)" = 1 } } + { + name = mono + type = builtin + label = mixer + } ] - inputs = [ "mix:In 1" "mix:In 2" ] - outputs = [ "mix:Out" ] + links = [ + { output = "normalize:Output 1", input = "mono:In 1" } + { output = "normalize:Output 2", input = "mono:In 2" } + ] + inputs = [ "normalize:Input 1" "normalize:Input 2" ] + outputs = [ "mono:Out" ] } capture.props = { node.name = "mix_input.bitvis" From 32b75696c24baa94eb4d5b1360da251472e8b8f1 Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sun, 1 Jun 2025 21:37:30 +0200 Subject: [PATCH 2/2] music/librespot: Use jackaudio backend --- roles/music/handlers/main.yaml | 2 +- roles/music/tasks/librespot.yaml | 7 +++++++ roles/music/templates/librespot.service | 12 ++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/roles/music/handlers/main.yaml b/roles/music/handlers/main.yaml index 28b6f59..71351d1 100644 --- a/roles/music/handlers/main.yaml +++ b/roles/music/handlers/main.yaml @@ -48,7 +48,7 @@ - name: rebuild librespot ansible.builtin.command: - cmd: /root/.cargo/bin/cargo build --release --features pulseaudio-backend + cmd: /root/.cargo/bin/cargo build --release --features pulseaudio-backend,jackaudio-backend args: chdir: /opt/librespot diff --git a/roles/music/tasks/librespot.yaml b/roles/music/tasks/librespot.yaml index 9d062ce..0857eaa 100644 --- a/roles/music/tasks/librespot.yaml +++ b/roles/music/tasks/librespot.yaml @@ -1,4 +1,11 @@ --- +- name: Install apt dependencies + apt: + name: + - libasound2-dev + - libjack-dev + - pkg-config + - name: Create librespot user user: name: "{{ music_librespot_user }}" diff --git a/roles/music/templates/librespot.service b/roles/music/templates/librespot.service index e90c3cb..419d52b 100644 --- a/roles/music/templates/librespot.service +++ b/roles/music/templates/librespot.service @@ -7,10 +7,14 @@ After=network.target [Service] Type=simple Restart=always -RestartSec=2s -ExecStart=/opt/librespot/target/release/librespot --name Trollibox --backend pulseaudio --volume-ctrl linear -Environment="PULSE_SERVER={{ music_pulse_server }}" -User={{ music_librespot_user }} +RestartSec=10s +ExecStart=/usr/bin/pw-jack -s 44100 /opt/librespot/target/release/librespot --name Trollibox --backend jackaudio +ExecStartPost=/usr/bin/sleep 4 +ExecStartPost=-/usr/bin/pw-link librespot:out_0 alsa_output.usb-ASUS_Xonar_U7_MKII-00.analog-stereo:playback_FL +ExecStartPost=-/usr/bin/pw-link librespot:out_1 alsa_output.usb-ASUS_Xonar_U7_MKII-00.analog-stereo:playback_FR +# User={{ music_librespot_user }} +User=root +Environment="XDG_RUNTIME_DIR=/run/user/{{ music_audio_user_id }}" [Install] WantedBy=multi-user.target