The Hifiberry DSP Board is available as an addon to their DAC (DAC2 Pro/HD) and transport hats (Digi2 Pro) or integrated in the dac (DAC+ DSP) or amp (beocreate 4).
The DSP Addon Board has some extra Connectors on the side, so it will not be easily connected to other Boards.
it hosts a ADAU1451 chip from Analog Devices. They also provide Sigma Studio a Software to configure the device.
From Sigma Studio a project can be exported as an xml file. This part is being done by Hifiberry. They provide dspprofiles on github. The dspproj files are used in Sigma Studio (as 'sourcecode'), the xml file can be uploaded to the DSP device.
All this you dont have to know when you use Hifiberry OS, an image for the raspberry pi. The latest version requires a 64bit system, so a Pi4 is probably the best option.
Hifiberry OS does a lot to hide the underlying complexity from the user and provide a nifty graphical user interface. Somethings like rotating the display can at the time of this writing not be done in the UI and need ssh to login and chage the lcd-rotate entry in /boot/config.txt.
in all fairness the local display is marked as an experimental feature. A lot of effort has gone into providing a pleasing interface and most DSP features can be accessed from there.
Hifiberry OS is build around mpd and has docker container to provide other renderer like squeezelite for Lyrion. The connection to LMS is handled via lmsmpris. This gives you basic player commands in the UI.
This alone is enough for me to abandon my moode project.
It is very easy to get a music player system with a clean looking webinterface and very few parameters need to (or can) be configured.
Yet it can of cause not compete with the elaborate integration of the jivelite interface on piCorePlayer.
Documentation on the Hifiberry DSP implementation is seriously lacking, which makes it more difficult to port than it should be. A fair bit of source code reading was required on my part to get this working. Luckily the tools are written in python and are easy to grasp.
There are 2 programms:
sigmatcpserver
dsptoolkit
Sigmatcpserver runs in the background and operates on the DSP chip. When so configured it should be possible to interact with Sigma Studio directly (not tested yet)
Dsptoolkit is the hifiberry tool to send requests to sigmatcpserver.
The programm code is provided on github.
Setup on piCorePlayer requieres a couple of extensions to be installed
binutils.tcz
python3.11.tcz
python3.11-pip.tcz
git.tcz
distcc.tcz
vim.tcz
dbus-python3.11-dev.tcz
libasound-dev.tcz
libxslt-dev.tcz
libxml2-dev.tcz
ncurses-terminfo.tcz
SPI is requiered (dtparam=spi=on) and seems to be set by default in piCorePlayer.
git clone https://github.com/Gadgetoid/py-spidev.git
cd py-spidev
python3.11 setup.py install --user
The --user option lets python install into the user domain. This will be made persistent in mydata.tgz later.
A better option would be to create an extension.
python3.11 -m pip install --user --upgrade hifiberrydsp
mkdir ~/.hifiberry
mkdir ~/.dsptoolkit
if the installation was successfull the server can be started with
/usr/local/bin/python3.11 /home/tc/.local/bin/sigmatcpserver --localhost
There are no documented options and sigmatcpserver --help is not implemented.
From the source code i understood:
--localhost
limits the server to listen to localhost only. This seems to be a sensibel default unless a direct communication with Sigma Studio is needed or a Hifiberry OS instance running on another device could be setup to provide the UI for the dsp settings ???
--alsa
used for controlling the volume through the alsamixer. Not relevant for the digi+.
--lgsoundsync
Implements reverse-engineered LG Sound Sync to set main volume control ???
When the server is running
dsptoolkit get-meta detected_dsp
should report the dsp as set in sigmatcpserver. For some obscure reason it is set to 'ADAU15xx'
If everything works as expected save the setup:
pcp bu
Some defitions might help to clarify the following statements:
- DSP program is a set of commands that the DSP runs. Think of it as assembler code for the DSP. This also includes register settings.
- register is a place to store data on the dsp chip. Think of it as a variable in hardware.
registers are 16bits while RAM is 32bits
- DSP profile wraps the DSP program and additional metadata in to an XML file.
- Metadata attributes map RegisterNames to RegisterAdresses so the dsptoolkit programm
can access them.
Some documentation on using dsptoolkit can be found here.
The latest profiles are maintained in https://github.com/hifiberry/dspprofiles.
Also there are profiles to be found in dsptoolkit and hiberry os, but this are not necessarily the latest version.
When getting a profile from github make sure it is the right one for your device. Loading the wrong profile can make your soundcard unusable. The profile for the addon can be downloaded like so:
wget -P ~/.dsptoolkit https://raw.githubusercontent.com/hifiberry/dspprofiles/refs/heads/master/dspaddon/dsp-addon-96-14.xml
When you open the file (with less) you should see a beometa section. This Metadata is added by hifiberry and needed by dsptollkit to get relevant information from the file. The profile can be installed on the dsp like so.
dsptoolkit install-profile .dsptoolkit/dsp-addon-96-14.xml
Information about the installed profile can be accessed with:
dsptoolkit get-meta <ATTRIBUTE>
dsptoolkit get-meta profileVersion
Things around samplerate are a bit complicated since there are different writings used in the profiles floating around.
dsptoolkit get-samplerate
therfore first tries to read the samplerate Attribute and if that fails sampleRate. If that also fails it returns 48000.
To get the 'real' value in the Attribute.
dsptoolkit get-meta samplerate or dsptoolkit get-meta sampleRate is more reliable.
Could not find documentation on this. From the source code i gather:
dsptoolkit <type> <frequency> <value>
Supported type is either ls (low shelf) or hs (high shelf)
Frequency is a number (float string) greater 0 the Hz is optional
Value is a number (float string) the db is optional. Negative values need to be escaped with --
dsptoolkit tone-control ls 200Hz 3db
The Filterbank has 16 Slots (as reported by dsptoolkit) I assume this is defined in the profile.
In REW i set the Equalizer to 16 Filters and Samplerate to 96k matching the loaded profile dsp-addon-96-14.xml.
The Filter is then exported as text. And transferred to the player by scp. (Note: setting up a NFS mount would be convenient)
dsptoolkit apply-rew-filters-left Left-VA-S16-225-T1.txt
When everything works dsptoolkit prints something like:
Filters configured on both channels:
Peaking Eq 167.5Hz -8.6dB
Peaking Eq 56.3Hz -6.0dB
Low shelf 80.0Hz -1.1dB
Peaking Eq 71.9Hz 2.0dB
Peaking Eq 195.0Hz 3.0dB
It is rather irritating that it says 'both' channels. This is because the print statement in the set_iir_filters function does not report the mode parameter (Left or Right).
Before the new filters are set the filter banks get cleared.
With commands above the changes are not persistent and are being lost after a powercycle.
dsptoolkit store
this stores the changed values of the attributes to the eeprom and makes them persistent, provided the attribute is defined as storable in the metadata.
set-balance:
the function is implemented in dsptoolkit, but can not be called.
apply-settings,check-eeprom,read-dec,read-hex,read-int,read-reg, load:
The profile defines/limits what can be done with the dsp.
Extending the profile in Sigma Studio seems quite a challenge.
Sorted by assumed complexity i would like to:
add mute
add adaptive loudness
add a convolver