Raspberry Pi with Piano2.1 DAC DSP and Volumio2

Question : How much DSP related processing can an RPI3B do with an appropriate DAC? I would like it to be the music player as well as an active XO with EQ or DRC ?

If the above is possible, you could make a wireless headless media player, that can provide active XO + EQ for custom speakers and perform DRC for the room. It might even be small and cheap enough to embed in the speaker(s).

There is an interesting DAC from TI (PCM5142) that has a mini (nano) DSP built in. The Allo Piano2.1 HAT has 2 of these stereo DACs (4 outputs) and was intended to be used as a 2.1 system (stereo + subwoofer). However, the DSPs can be re-purposed if there is enough processing available.

There are many variants of Audio players available for Raspberry PI. Audio is a fairly easy task for an RPI3B (1.2Ghz quad core) so there should be plenty of cycles left for other tasks. There are a few projects aiming to provide convolution engines (BruteFir) and equalizers for the pi.

Setup Index :
1) Remote SSH access - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
2) Adding Ecasound - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
3) Adding more loopbacks - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
4) Adding Brutefir - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
5) Linkwitz transform - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
6) REW + UMIK - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
7) Update Ecasound + Brutefir configurations - Raspberry Pi with Piano2.1 DAC DSP and Volumio2

Tools Index :
TI PurePath config to bin converter : Raspberry Pi with Piano2.1 DAC DSP and Volumio2

Firmware Index :
2) v2.2-2 : 2way XO woofer LR4 tweeter LR4 - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
3) v2.2-3 : 2way XO woofer BW2 + sub LR4 - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
4) v2.2-4 : mono test build to compare active to passive XO - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
5) v2.2-5 : pass through fronts, subwoofer LR2+LR4 - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
6) v2.2-6 : 2way FAST/WAW BW1 - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
7) v2.2-7 : 2way FAST/WAW LR2 - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
8) v2.2-8 : pass through fronts with seperate LR4 HP for tweeters - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
8b) v2.2-8b : same as 2.2-8 alt pinout : Raspberry Pi with Piano2.1 DAC DSP and Volumio2
9) v2.2-9 : 2way Harsch filter FAST/WAW - Raspberry Pi with Piano2.1 DAC DSP and Volumio2
 

Attachments

  • DSCN2019 reduced.jpg
    DSCN2019 reduced.jpg
    512.3 KB · Views: 3,427
Last edited:
Baseline

The RPI3B was loaded with Volumio2 (V2.2) , a couple of heatsinks were added, the Allo Piano2.1 DAC was installed and it's all powered by a standard 5VDC supply. The case is from Buyapi and has knockouts for the RCA jacks.

The Piano2.1 needs a couple a switches set for RPI compatibility. Easy enough.

Volumio has drivers for the Piano and the web intf has menus to select the Piano DAC and its various modes. Volumio also has many playback options and sampling features. I like it.

Out of the box, I tried configurations as both as a 2.0 Stereo and a 2.1 Stereo plus Subwoofer to see what it sounded like. Its quiet and it sounds good to me.

Everything seems to work.
 
Last edited:
Clock domains

The issue of playback clocks always seem to come up with the RPI DAC hats so I'll state my opinion on it.

The 19.2MHz clock (oscillator) cannot easily generate a 44.1KHz signal without introducing jitter because it requires fractional dividers. Its not a integer submultiple.

Volumio2 has resampling so you could resample to 48KHz (or higher multiple) which can be generated jitter free from a 19.2MHz clock.

I've tried both and the difference is very small but you can hear it.
 
Using the DSP in the DACs - Test1

The TI PCM5142 DACs have a small DSP embedded in them. I wanted to use them for either XO or EQ to offload the RPI.

Programming the DSPs requires TI PurePath S/W. I have a free license but they are slow in handing them out :). It is an excellent design suite.

Volumio is able to upload the DSP bin files to the DACs. There are a number of DSP files already. So to make my life easy, I'll create my own program and swap it with an existing file so I can use Volumio's menus to load it.

First test : I created a mono signal from the stereo, then low passed everything to the left speaker, and high passed everything to the right speaker. This was an easy way to confirm the process. The process I used was from Allo's website, only I used a Java program to "process" the TI cfg file to the required Allo bin file. This test also looks like an XO as the filters used are 8th order Butterworth.

It works properly, and only used about 25% of the DSP resources.
 

Attachments

  • schematic.jpg
    schematic.jpg
    314.7 KB · Views: 2,781
  • low pass BW8.jpg
    low pass BW8.jpg
    161.1 KB · Views: 2,676
  • high pass BW8.jpg
    high pass BW8.jpg
    161.8 KB · Views: 2,621
Using the DSP in the DACs - Test2

In this test, we have stereo with speaker EQ and sub support.

Both channels are high passed at 80Hz using BW4. The speaker EQ uses 4 Biquad EQ blocks per channel. This was a quick test and ended up being too coarse an EQ. This is a similar DSP load to the previous test. It sounded OK but needs refinement.
 

Attachments

  • SpeakerEQ.jpg
    SpeakerEQ.jpg
    171.3 KB · Views: 322
  • HighPass SubSupport.jpg
    HighPass SubSupport.jpg
    164.2 KB · Views: 382
  • schematic.jpg
    schematic.jpg
    290.2 KB · Views: 2,567
Using the DSP in the DACs - Done

I spent a bit more time to actually finesse the filters this time.

The subwoofer channels (DAC#1) use a mixed RL low passed at 80Hz (BW4) and sent to both outputs. The difference this time is the use of extended precision in the coeffs. One of the problems with setting low cutoff frequencies in a digital IIR (biquad) is that the coefficients get close to unity (ie. 0.99999965) and preserving significance is a problem.

The stereo channel (DAC#0) is high passed at 80Hz (BW4) and has additional speaker EQ. The EQ curve was initially generated earlier by REW and then manually repeated here using 6 biquads. The speakers have an internal passive LR4 but the driver responses are not FR flat. This EQ curve helps that. The DSP load is at 42% utilization now.

Overall it sounds good. This means I can do active XO and speaker EQ in the DAC's DSP.
 

Attachments

  • OmniSub.jpg
    OmniSub.jpg
    301.6 KB · Views: 364
  • SubLP.jpg
    SubLP.jpg
    162.1 KB · Views: 303
  • OmniStereoSub.jpg
    OmniStereoSub.jpg
    297.8 KB · Views: 316
  • OmniSteroHP.jpg
    OmniSteroHP.jpg
    168.3 KB · Views: 330
  • OmniEQ.jpg
    OmniEQ.jpg
    178.7 KB · Views: 255
Last edited:
Last edited:
Succeeded with BruteFir2 plugin - Equalizer

After reading some other posts on this plugin I'm sure [Balbuze] will succeed in cleaning up these known issues.

What worked for me : 1) set the Piano in 2.0 mode, upload & install BruteFir2, clear play queue and reboot. 2) enable the BruteFir2 plugin and reboot 3) do not change the new playback options which appear to be wrong but actually work [I2S off, BruteFir output].

It seems I was trying to "correct" things by enabling the I2S and reselecting Piano2.1 output which will cause no output and loose the NAS connection.

If you want to return to original setting : disable BruteFir plugin, reselect I2S and Piano2.1 , clear the playlist queue and reboot

I get good sound out, the rest of Volumio works, and the BruteFir2 equalizer works although its only 1 octave, 10 band.

Next item : importing REW filters and trying the BruteFir convolution engine.
 
Last edited:
CPU load, so far

I have all the components [Volumio, DAC DSP, BruteFir, Equalizer] so how does the loading look. The test music is an mp3@256kbps sampled at 44.1KHz from a NAS over wifi. Utilization was observed from the terminal interface using "top".

1) Volumio2 only : mpd uses CPU@4% avg (cycles from 1% to 7%)
2) Volumio2 , resample to 48KHz : mpd uses CPU@33% avg
3) Volumio2 , BruteFir2 64K taps uses CPU@36%, mpd uses CPU@4%
3) Volumio2 , BruteFir2 128K taps uses CPU@40%, mpd uses CPU@4%

The 10band equallizer uses 1% CPU when active and is part of BruteFir plugin. Volumio (soxr ?) resampling does not seem to work with BruteFir plugin. Only Piano2.0 mode works with the Brutefir plugin, there is no output when Piano2.1 or 2.2 are used.
 
BruteFir2 convolution based EQ

I used REW to generate a filter to smooth out the FR response of a speaker. The filter's impulse response was 128K sample output (16b and 32b versions) to a wav file for BruteFir.

I should add, that this filter wav file was tested on a PC using EqualizerAPO. So I have a PC based source and a RPI source using the same music, same amp, same filter, and same speakers. The only difference is the convolution implementations. I also have a 30band equalizer set in the PC EqualizerAPO that I compare to the PC convolution based filter. They are very similar in sound quality with the convolution having a minor advantage in quality.

The RPI and Piano2.0 (no DAC DSP) sound very good on their own. The BruteFir convolution works but it's sound is not as good as the PC's EqualizerAPO. It sounds duller with less detail and I proved that by boosting the 2-5Khz range. I've tried many BruteFir settings but don't understand why. It sounds like compression (only a guess). I'm sure something (setting, format, etc) is wrong.
 
2) Volumio2 , resample to 48KHz : mpd uses CPU@33% avg

CPU utilization seem high... Can you post your mpd.conf setting for the resampling.

I faintly recall that when I tried resampling in mpd there was one appropach that was much ore CPU intensive (both were resampling to 48kHz, just the resampling lib changed). I seem to recall that using Soxr resampling under mpd was best, but I would have to check my own mpd.conf file to confirm.
 
Last edited:
No problem, help is always welcome.

It looks like Volumio2 is modifying "/etc/mpd.conf" so I'll post key parts for resample 48KHz (33% cpu avg) and 192KHz (55% cpu avg)

===== 48KHz =======
# Audio Output

resampler {
plugin "soxr"
quality "high"
threads "0"
}

audio_output {
type "alsa"
name "alsa"
device "hw:1,0"
dop "no"
format "48000:*:2"

===== 192KHz ===========
# Audio Output

resampler {
plugin "soxr"
quality "high"
threads "0"
}

audio_output {
type "alsa"
name "alsa"
device "hw:1,0"
dop "no"
format "192000:*:2"

=======================​
 
Correction : "top" default is %core not %total CPU

Correction.

It occurred to me that there are 4 cores and I don't know how "top" treats them. Turns out, the default for "top" is %core and not %total. You can shift to %total using [shift] while "top" is running. So take all those previous numbers and divide /4 for %total cpu. That is much better.

Correction for Raspberry Pi with Piano2.1 DAC DSP and Volumio2

1) Volumio2 only : mpd uses CPU@1% avg (cycles from 0.25% to 2%)
2) Volumio2 , resample to 48KHz : mpd uses CPU@8% avg
3) Volumio2 , BruteFir2 64K taps uses CPU@9%, mpd uses CPU@1%
3) Volumio2 , BruteFir2 128K taps uses CPU@10%, mpd uses CPU@1%

Correction for Raspberry Pi with Piano2.1 DAC DSP and Volumio2

1) resample 48KHz (8% cpu avg) and 192KHz (14% cpu avg)
 
more BruteFir

Another trial, and getting a little closer.

I found Brutefir will work with the Piano DAC in 2.1 mode. For some reason there is a delay of nearly 30sec to resume operation when enabling the brutefir plugin when the 2.1 mode with sub is enabled. I can only assume processes are being restarted. It's only a one time event, on mode switches, and I was too impatient before.

This time I used a 16K tap with 32b LPCM from RePhase. It sounds OK but there are some issues. When I select a 16K tap I get a short delay echo, however when I select 8K tap it works fine. The volume seems to be down 6db or so and I still think some HF is missing. The good news is that the shorter tap only takes 14% of a core per side, so overall 7% of the CPU.

Looks like I need to dig through "conf" files now.
 
hi here !

I'm balbuze. I wrote the plugin brutefir for volumio2.
I'm happy to see I'm not the only user of it ! Just to say that if you think/need more/other settings/features for the plugin, let me know. If possible, I'll add them.
I'm not a specialist of brutefir but I did the plugin to make as easy as possible the installation and settings. So maybe I missed something.
Reading the thread I made change in the plugin.
I uploaded a new version in wich the output device appears clearly (example : "Iqaudio DAC plus through brutefir") instead of "brutefir plugin" . The i2s dac still appears as desactivated, but it is not! Don't worry about that and don't try to correct it or the plugin won't work.
Let me know.
 
I'm balbuze. I wrote the plugin brutefir for volumio2.
I'm happy to see I'm not the only user of it ! Just to say that if you think/need more/other settings/features for the plugin, let me know. If possible, I'll add them.
I'm not a specialist of brutefir but I did the plugin to make as easy as possible the installation and settings. So maybe I missed something.
Reading the thread I made change in the plugin.
I uploaded a new version in wich the output device appears clearly (example : "Iqaudio DAC plus through brutefir") instead of "brutefir plugin" . The i2s dac still appears as desactivated, but it is not! Don't worry about that and don't try to correct it or the plugin won't work.
Let me know.

Thanks Balbuze, I have loaded the new version and the relabeling does make it clearer. For some reason, I was not notified when you posted this so my response is a bit late. I have read a number of other posts ( balbuze/volumio-plugins - Gitter ) that have helped and I appreciate the effort that you put into the plugin. I'm currently occupied with my other project OmniDirectional - work in progress that will eventually use the RPI. There is still a difference in sound (using same filter) between Brutefir and EQ-APO that I think is related to settings. I'll let you know what I find.