I spend all day setting up a Pi Zero W with shairport-sync and bruteFIR. It works fine using the alsa loopback method, but I still have to start bruteFIR manually. This is my unit file, is there anything wrong?
Code:
[Unit]
Description=BruteFIR
[Service]
ExecStart=/usr/bin/brutefir /home/brutefir/brutefir_config
Restart=on-failure
RestartSec=1
[Install]
WantedBy=multi-user.target
Some ideas.
Do you want to run it as user brutefir ?
Once you start brutefir it'll look for the default config in ~
In your case it would be /root
But I guess you'd have it in /home/brutefir
IC 2 potential ways out.
Either you add all config parameters to your customized config and start brutefir with
"-nodefault" . Then you can run it as whatever user. The paths references in the customized config file must be accessible though.
or you add e.g.
As far as I recall running brutefir standalone with aloop doesn't work. brutefir needs an audio input.
Perhaps you also need to add
After=shairpoint-sync
if shairpoint-sync would be a service.
shairport sync would then keep brutefir alive.
All just some wild ideas. I might try to set it up myself on a PI4.
Could you share your config?
Let us know if and how you made it work.
Do you want to run it as user brutefir ?
Once you start brutefir it'll look for the default config in ~
In your case it would be /root
But I guess you'd have it in /home/brutefir
IC 2 potential ways out.
Either you add all config parameters to your customized config and start brutefir with
"-nodefault" . Then you can run it as whatever user. The paths references in the customized config file must be accessible though.
or you add e.g.
Code:
[Unit]
Description=BruteFIR
[Service]
User=brutefir
Group=audio
ExecStart=/usr/bin/brutefir /home/brutefir/brutefir_config
Restart=on-failure
RestartSec=1
[Install]
WantedBy=multi-user.target
As far as I recall running brutefir standalone with aloop doesn't work. brutefir needs an audio input.
Perhaps you also need to add
After=shairpoint-sync
if shairpoint-sync would be a service.
shairport sync would then keep brutefir alive.
All just some wild ideas. I might try to set it up myself on a PI4.
Could you share your config?
Let us know if and how you made it work.
Still doesn't work, I have to login and restart the brutefir service, then it works. Posting my full config below.
/etc/systemd/system/brutefir.service:
/etc/asound.conf:
/home/brutefir/brutefir_config:
/etc/systemd/system/brutefir.service:
Code:
Description=BruteFIR
After=shairport-sync.service
[Service]
User=brutefir
Group=audio
ExecStart=/usr/bin/brutefir /home/brutefir/brutefir_config
Restart=on-failure
RestartSec=1
WorkingDirectory=/home/brutefir
[Install]
WantedBy=multi-user.target
/etc/asound.conf:
Code:
# Run the following commands as root to load the ALSA loopback-device on boot automatically:
#
# echo 'snd-aloop' > /etc/modules-load.d/brutefir-alsa-loopback.conf
# echo 'options snd-aloop id=BruteFIR enable=1 pcm_substreams=1 pcm_notify=1' > /etc/modprobe.d/brutefir-alsa-loopback.conf
#
#
# Create an ALSA default audio-device for the ALSA loopback-device.
pcm.!default {
# Use the ALSA plug-in "plug" for rate-/format-conversion.
type plug
# Forward the audio stream of OSMC/KODI to the ALSA loopback-device
slave {
pcm {
# Direct hardware access
type hw
# Loopback card name
#
# Has to match "id" in the options of the snd-aloop module
card "BruteFIR"
# Loopback device ID
device 0
# Number of audio channels
#
# Has to match the number of channels in OSMC/KODI (e.g. 7.1 -> 8)
# and "channels" in the BruteFIR input configuration
channels 2
# Format of audio stream
#
# Has to match the format defined in the "sample"-tag
# of the BruteFIR input configuration
format "S16_LE"
# Sampling-rate of audio stream
#
# Has to match the sampling-rate defined in the global "sampling_rate"-tag
# of the global BruteFIR configuration
rate 44100
}
}
}
# Create an ALSA default control-device for the ALSA loopback-device.
ctl.!default {
# Direct hardware access
type hw
# Loopback card name
#
# Has to match "id" in the options of the snd-aloop module
card "BruteFIR"
}
/home/brutefir/brutefir_config:
Code:
## DEFAULT GENERAL SETTINGS ##
float_bits: 32; # internal floating point precision
sampling_rate: 44100; # sampling rate in Hz of audio interfaces
filter_length: 8192,16; # length of filters
#config_file: "~/.brutefir_config"; # standard location of main config file
overflow_warnings: true; # echo warnings to stderr if overflow occurs
show_progress: false; # echo filtering progress to stderr
max_dither_table_size: 0; # maximum size in bytes of precalculated dither
allow_poll_mode: false; # allow use of input poll mode
modules_path: "."; # extra path where to find BruteFIR modules
monitor_rate: false; # monitor sample rate
powersave: true; # pause filtering when input is zero
lock_memory: true; # try to lock memory if realtime prio is set
sdf_length: -1; # subsample filter half length in samples
safety_limit: -0.01; # if non-zero max dB in output before aborting
convolver_config: "~/.brutefir_convolver"; # location of convolver config file
## COEFF DEFAULTS ##
coeff "c-l" {
# filename: "/home/brutefir/Cor1L44.dbl";
filename: "dirac pulse";
format: "FLOAT64_LE";
};
coeff "c-r" {
# filename: "/home/brutefir/Cor1R44.dbl";
filename: "dirac pulse";
format: "FLOAT64_LE";
};
## INPUT DEFAULTS ##
#
input "left_in", "right_in" {
device: "alsa" { device: "hw:BruteFIR,1"; ignore_xrun: true; };
sample: "S16_LE";
channels: 2;
};
## OUTPUT analog
#
output "left_out", "right_out" {
device: "alsa" { device: "hw:2,0"; ignore_xrun: true; };
sample: "S16_LE";
# dither: true;
};
## FILTER DEFAULTS ##
filter "drc_l" {
from_inputs: "left_in";
to_outputs: "left_out";
coeff: "c-l";
};
filter "drc_r" {
from_inputs: "right_in";
to_outputs: "right_out";
coeff: "c-r";
};
Have you enabled the brutefir.service with systemctl? systemd: how to enable a service automatically from the first boot? - Unix & Linux Stack Exchange
Have you enabled the brutefir.service with systemctl?
That was it, goddamnit, thanks!
I didn't manage to run brutefir as non-root, it wouldn't start despite adding "LimitRTPRIO=infinity", and with that it wouldn't run as realtime which doesn't work. I also didn't manage to start the service via shairport using the "run_this_before_entering_active_state" directive, but luckily I don't need that anymore.
I found daemon tools to work quite well. It automatically restarts BruteFIR if buffer overruns or underfund occur. And of course start on boot up.
Last edited:
Alright, so my TOSLINK interface arrived (JustBoom Digi Zero pHAT), connected to my KEF LSX - works!
I created brutefir filters via UMIK-1 and REW, but the result is a lot worse than just running "dirac pulse". Not yet sure why, but its a start. Thanks for the support so far!
I created brutefir filters via UMIK-1 and REW, but the result is a lot worse than just running "dirac pulse". Not yet sure why, but its a start. Thanks for the support so far!
- Home
- Source & Line
- PC Based
- Starting bruteFIR automatically