Volumio with MPD 19.11 Pipe Out and Brutefir

Dear all,

my name is Christian from Germany and since half a year I am using Raspberry Pi 2 & Hifiberry Dac+ with Volumio 1.55 as primary music player. I am happy so far but recently I bought new speakers which are now capable to go below 30 Hz and became aware of the severe room resonancies in my living room. Thus I decided to realize a room correction on the raspberry. To do so, I compiled & installed the latest MPD 0.19.11 with pipe out option, I compiled & installed fftw-3-3-4 and finally brutfir 1.0m. Everything was compiled with GCC 4.9. In my mpd.conf I put

audio_output {
type “pipe”
name “brutefir pipe”
command “/usr/local/bin/brutefir -nodefault /home/brutefir/.brutefir_config”
format “44100:32:2”
}

as output.

My brutefir_config has the following input section

[i]## INPUT DEFAULTS ##

input “leftin”,“rightin” {
device: “file” { path: “/dev/stdin”; }; # module and parameters to get audio

device: “file” {};# path: “/dev/stdin”; }; # module and parameters to get audio

sample: “S32_LE”; # sample format
channels: 2/0,1; # number of open channels / which to use
delay: 0,0; # delay in samples for each channel
maxdelay: -1; # max delay for variable delays
subdelay: 0,0; # subsample delay in 1/100th sample for each channel
mute: false,false; # mute active on startup for each channel
};[/i]

Unfortunately I cannot manage to get the pipe output work. In my MPD log, I get the following output:

[i]Nov 15 17:38 : client: [11] closed
Nov 15 17:38 : client: [13] opened from 127.0.0.1:57673
Nov 15 17:38 : client: [14] opened from 127.0.0.1:57675

BruteFIR v1.0m (November 2013) © Anders Torger

Nov 15 17:38 : client: [13] closed
Internal resolution is 64 bit floating point.
Creating 4 FFTW plans of size 8192…finished.
Loading 2 coefficient sets…finished.
Failed to open module “file” in “/usr/local/lib/brutefir/file.bfio”: /usr/local/lib/brutefir/file.bfio: undefined symbol: __aeabi_idivmod.
Nov 15 17:38 : errno: “brutefir pipe” [pipe] failed to play: Write error on pipe: Broken pipe
Nov 15 17:38 : output: Failed to open audio output
Nov 15 17:38 : client: [14] closed
Nov 15 17:38 : client: [15] opened from 127.0.0.1:57681
Nov 15 17:38 : client: [16] opened from 127.0.0.1:57682
Nov 15 17:38 : client: [16] closed
Nov 15 17:38 : client: [17] opened from 127.0.0.1:57688
Nov 15 17:38 : player: played “http://188.94.97.91/radio21.mp3
Nov 15 17:38 : client: [17] closed[/i]

I was not able to find what this undefined symbol “__aeabi_idivmod.” could be. Does anyone have a hint what might be my issue?

Best regards

Christian

Hi Christian,

afaik HifiBerry DAC+ max. samplerate is 24 bit.

Regards

Klaus

Hi Klaus,
yes thats right. I will try tomorrow…although I think that the Issue is somewhere in the pipe buffer as I assume that I also tried s16LE. I’ll give feedback…

Regards

Christian

Gesendet von iPad mit Tapatalk

Hi Klaus,

I tried with 16 bit and also checked file as output device. The situation with

Failed to open module “file” in “/usr/local/lib/brutefir/file.bfio”: /usr/local/lib/brutefir/file.bfio: undefined symbol: __aeabi_idivmod.
Nov 18 06:50 : errno: “brutefir pipe” [pipe] failed to play: Write error on pipe: Broken pipe

stays unchanged.

Regards

Christian

Hi Christian,

could you try this?

for /etc/mpd.conf

audio_output { type "pipe" name "brutefir pipe" command "/usr/local/bin/brutefir -nodefault /home/.brutefir.conf" format "44100:16:2" }

and for ~/.brutefir.config

[code]sampling_rate: 44100;
filter_length: 32768,16;
overflow_warnings: true;
float_bits: 64;

input “left”, “right” {
device: “file” {path: “/dev/stdin”;};
sample: “FLOAT64_LE”; # sample format
channels: 2; # number of open channels / which to use
delay: 0,0; # delay in samples for each channel
maxdelay: -1; # max delay for variable delays
mute: false,false; # mute active on startup for each channel
};

output “left”, “right” {
device: “file” {path: “/dev/stdout”;};
sample: “S16_LE”; # sample format
channels: 2; # number of open channels / which to use
delay: 0,0; # delay in samples for each channel
maxdelay: 100; # max delay for variable delays
mute: false,false; # mute active on startup for each channel
dither: false; # no dither for 32 bit output
};

factor 0.4 to avoid clipping

filter “M direct” {
from_inputs: “left”//0.4, “right”//0.4;
to_filters: “left direct”, “right direct”;
coeff: -1;
crossfade: false;
};

here 0.8 instead of 0.4 because the filter “in average” multiplies with 0.5

(one could make 0.8 a bit larger/smaller to obtain a wider/narrower

stereo image, but better use RACE for this)

filter “S filter” {
from_inputs: “left”//0.8, “right”//-0.8;
to_filters: “left direct”, “right direct”;
#coeff: “S channel”;
coeff: -1;
crossfade: false;
};

filter “left direct” {
from_filters: “M direct”//1.0, “S filter”//1.0;
to_outputs: “left”/0.0;
#coeff: “left_default”;
coeff: -1;
crossfade: false;
};

filter “right direct” {
from_filters: “M direct”//1.0, “S filter”//-1.0;
to_outputs: “right”/0.0;
#coeff: “right_default”;
coeff: -1;
crossfade: false;
};

[/code]

Hi Klaus,

it delivers another error message

[i]BruteFIR v1.0m (November 2013) © Anders Torger

Parse error on line 75 in file “/home/brutefir/.brutefir_config”:
At least one mandatory field is missing in /home/brutefir/.brutefir_config.[/i]

I will check tomorrow what is missing in the config file…

Thanks so far!

Christian

Strange. The script contains only 60 lines…

Regards

Klaus

correct, there were some lines of notes in front thus 75 is the final line where the parser is complaining.

Best regards

Christian

  1. Check your MPD version mpd -V there must be “pipe” in the Output section
    otherwise you are using the wrong Version and you will have to edit the corresponding init.d file
sudo nano /etc/init.d/mpd
[/code] to [code]
DAEMON=/usr/local/bin/mpd
[/code] . Check again after [code]
sudo service mpd restart
  1. Get Volumio running with the new Version of mpd. Post the output of aplay -l , so we can get the right enumeration of your soundcard.

Next step will be testing the pipe

Regards

Hi,

thanks for picking this up again! I was not able to solve by myself and just checked once again:

mpd -V

delivers

so I think I compiled correctly.

I edited the daemon path to

and restarted.

 aplay -l 

delivers

thus I assume that the brutefir_config output section like

output "leftout", "rightout" { #device: "equal" {}; device: "alsa" { device: "hw:0,0"; }; sample: "S16_LE"; # sample format channels: 2; # number of open channels / which to use delay: 0,0; # delay in samples for each channel maxdelay: 100; # max delay for variable delays mute: false,false; # mute active on startup for each channel dither: false; # no dither for 32 bit output };

should work. Nontheless MPD log states

Do you have a hint how to check the pipe?

Best Regards

Christian

  1. Is Volumio running with “standard Configuration” (mpd.conf)? Check this first ,otherwise make it work before you do the next step:

  2. Check the pipe.

Edit your mpd.conf:

audio_output { type "pipe" name "brutefir pipe" command "aplay -f cd 2>/dev/null" format "44100:32:2" }

Restart mpd
This should give you sound via aplay.

  1. I would suggest to get full Read/write access to /home/Volumio (to send filters and edit .brutefir_conf via Network)
sudo nano /etc/samba/smb.conf

and change

#volumio [Volumio] comment = volumio path = /home/volumio read only = no public = yes follow symlinks = yes wide links = yes

Post the whole .brutefir_config

Hi,

with the “standard” MPD.conf

[code]###################################

Auto generated mpd.conf file

please DO NOT edit it manually!

Use player-UI MPD config section

###################################

follow_outside_symlinks “yes”
follow_inside_symlinks “yes”
db_file “/var/lib/mpd/tag_cache”
sticker_file “/var/lib/mpd/sticker.sql”
log_file “/var/log/mpd/mpd.log”
pid_file “/var/run/mpd/pid”
music_directory “/var/lib/mpd/music”
playlist_directory “/var/lib/mpd/playlists”
state_file “/var/lib/mpd/state”
user “root”
bind_to_address “any”
port “6600”
zeroconf_enabled “yes”
zeroconf_name “volumio”
samplerate_converter “Fastest Sinc Interpolator”
volume_normalization “no”
audio_buffer_size “2048”
buffer_before_play “20%”
filesystem_charset “UTF-8”
id3v1_encoding “UTF-8”
gapless_mp3_playback “yes”
auto_update “no”
group “audio”
max_connections “20”

decoder {
plugin “ffmpeg”
enabled “yes”
}

input {
plugin “curl”
}

audio_output {

	 type           "alsa"
             name           "Output"
             device         "hw:0,0"
             mixer_type     "hardware"      
             mixer_device   "default"
             mixer_control  "Master"
             dop    "no"

}
[/code]

its playing without any issue. When I change output to


audio_output {
  type      "pipe"
  name      "brutefir pipe"
 command "aplay -f cd 2>/dev/null" 
   format      "44100:16:2"
}[/code]

it is also playing while 44100:32:2 is resulting in a noise overlay but this is a feature of the DAC+. 

For access to the raspberry I send you a PN. 

My current .brutefir_config is as follows

[code]## DEFAULT GENERAL SETTINGS ##

float_bits: 64;
sampling_rate: 44100;
filter_length: 32768,16;
overflow_warnings: true;

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: false;           # 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: -3;           # if non-zero max dB in output before aborting

convolver_config: "/home/brutefir/.brutefir_convolver"; # location of convolver config file



input "leftin", "rightin" {
        device: "file" {path: "/dev/stdin";};
        sample: "S16_LE";   # sample format
        channels: 2;            # number of open channels / which to use
        delay: 0,0;             # delay in samples for each channel
        maxdelay: -1;           # max delay for variable delays
        mute: false,false;      # mute active on startup for each channel
};

output "leftout", "rightout" {
        #device: "equal" {};
	device: "alsa" { device: "hw:0,0"; };
        sample: "S16_LE";   # sample format
        channels: 2;        # number of open channels / which to use
        delay: 0,0;         # delay in samples for each channel
        maxdelay: 100;      # max delay for variable delays
        mute: false,false;  # mute active on startup for each channel
        dither: false;      # no dither for 32 bit output
};



filter "left path" {
        inputs: "leftin";
        outputs: "leftout";
	coeff: -1;
       
};

filter "right path" {
        inputs: "rightin";
        outputs: "rightout";
       	coeff: -1;
};




#coeff "c-l" {
#   filename: "/home/brutefir/filter/LeftSpeakerImpulseResponse44100.pcm";
#   format: "S32_LE";
#};

#coeff "c-r" {
#   filename: "/home/brutefir/filter/RightSpeakerImpulseResponse44100.pcm";
#   format: "S32_LE";
#};


#filter "drc_l" {
#   from_inputs: "left";
#   to_outputs: "left";
#   coeff: "c-l";
#};

#filter "drc_r" {
#   from_inputs: "right";
#   to_outputs: "right";
#   coeff: "c-r";
#};

Best Regards

Christian

Ok Pipe is working; now we are going to check brutefir with a simple config.

  1. create a config file.
nano /home/volumio/.brutefirdirac_config

and paste the following

[code]float_bits: 32; # internal floating point precision
sampling_rate: 44100; # sampling rate in Hz of audio interfaces
filter_length: 4096,16; # length of filters
overflow_warnings: true; # echo warnings to stderr if overflow occurs
show_progress: true; # 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
convolver_config: “~/.brutefir_convolver”; # location of convolver config file

logic: “cli” { port: 3000; };

COEFFS

coeff “left” {
#filename: “/home/volumio/filter/filterl1.pcm”; #filterl
filename: “dirac pulse”;
format: “FLOAT_LE”;
attenuation: 0.0;
};

coeff “right” {
# filename:"/home/volumio/filter/filterr1.pcm"; #filterr
filename: “dirac pulse”;
format: “FLOAT_LE”;
attenuation: 0.0;
};

INPUT OUTPUT

input “left-in”, “right-in” {
device: “file” {path: “/dev/stdin”;};
#device: “file” {path: “/home/volumio/1.pcm”;};
sample: “S32_LE”;
channels: 2/0,1;
};

output “left-out”, “right-out” {
device: “alsa” {device: “hw:0”; ignore_xrun: true;};
#device: “file” {path: “/home/volumio/2.pcm”;};
#device: “file” {path:"/dev/stdout"; };
sample: “S16_LE”;
channels: 2/0,1;
};

FILTER

filter “leftfilter” {
from_inputs: “left-in”;
to_outputs: “left-out”;
coeff: “left”;
};

filter “rightfilter” {
from_inputs: “right-in”;
to_outputs: “right-out”;
coeff: “right”;
};[/code]

change the output section in your mpd.conf to

audio_output { type "pipe" name "brutefir pipe" command "/usr/local/bin/brutefir -nodefault /home/volumio/.brutefirdirac_config 2>/dev/null" #command "aplay -f cd 2>/dev/null" format "44100:32:2" }

restart mpd

As you can see, i turned mpd´s output pipe back to 32 bit, and changed it in brutefir´s output back to S16_LE.

This configuration does nothing except convolving with a Dirac signal.

Forgot one serious thing. You will not have any Volume control in Volumio, set the mixer type back to software in the beginning of your mpd.conf mixer_type "software"

and set the hifiberrys volume up in the alsamixer

Hi,

I just checked this configuration. It leads to this error message

The message that Brutefir startet

is missing as if Brutefir never startet.

when I change the output in mpd.conf to

audio_output { mixer_type "software" type "pipe" name "brutefir pipe" command "/usr/local/bin/brutefir -nodefault /home/volumio/.brutefirdirac_config" # 2>/dev/null" #command "aplay -f cd 2>/dev/null" format "44100:32:2" }

I result in my known error message

Best regards

Christian

Strange. This is exactly what is running here. Try to change the commandline in mpd to:

command      "brutefir -nodefault /home/volumio/.brutefirdirac_config" # 2>/dev/null"

Perhaps we should try the ssh thing once again :mrgreen:

I will try a fresh 1.55 image with a recompiled brutefir on the weekend as countercheck. alternatively I have prepared an ubunto 15.10 with mpd to check the behavior. I will give feedback…

Regards

christian

Gesendet von iPad mit Tapatalk

Hi,

Heureka! It is running now with your config. I installed everything several times. Initially I compiled MPD, FFTW3 and Brutefir by myself and resulted in the known error. Then I realized that there is also a compiled version of FFTW and Brutefir for raspi. After installing these, it suddenly worked.

Thank You very much for your helpful support. Now I will start playing with real filters :wink:

Best Regards

Christian

Nice to hear. If someone else is going through this i would suggest to edit the sudo nano /etc/apt/sources.list and set everything to Jessie (just change Wheezy to Jessie) and do a sudo apt-get update not more. After that sudo apt-get install brutefir mpd in Jessie MPD is already compiled with pipe. :mrgreen: That is all , no need to compile anything.
If you take a look at my config you can see, how filters are used, uncomment the dirac line with #.
A good start for creating Filters is rephase http://sourceforge.net/projects/rephase/ get a crash intro here https://www.minidsp.com/applications/advanced-tools/rephase-fir-tool or as fast start take a deeper look at my Example Image specially to the “Impulse Settings” on the right side. Please set up the number of Taps, in this Example the Value is 8192, usually i take 65536. In this Example you will get a file called impulseR.bin by hitting the “generate” Button. Rename bin to pcm and Brutefir will recognize it as FLOAT_LE (32 bits IEEE-754 mono (bin)).

When you edited the smb.conf as suggested before, you can put the filters on your pi via local network. You will have to restart mpd to get your new filters working.

Have Fun

Regards
rephase.png

Hi,

I will also test rephase. I currently use drc designer to create filters for foobar on a windows machine. they should work in brutefir as well. I will give feedback.

the hint with jessie is good, the configure and make process is quite time consuming …

Best Regards

Christian

Gesendet von iPad mit Tapatalk