Giter VIP home page Giter VIP logo

hifiberry-dsp's Introduction

Python package PyPI version PyPI license PyPI download month GitHub contributors

HiFiberry DSP

Software for HiFiBerry boards equipped with DSP. This package can be used to read/write data to HiFiBerry DSP boards using the Beocreate TCP server.

The software comes "as-is". There is no individual support for this software. Feel free to post in the HiFiBerry forum for questions.

Installation

Before installing the dsptoolkit, you need to have a working Python 3 installation (>=3.5) and a working pip. You also need to enable SPI as dsptoolkit needs SPI to communicate with the DSP. Check out https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/

You can then install the toolkit by just running

sudo pip3 install --upgrade hifiberrydsp

This will only install the software, but not activate the server. Depending on your system, you might need to create a startup script or a systemd unit file for this.

If you're using a Debian based system (e.g. Debian, Raspbian), there is a script that does all the work for you. Just run the following command:

bash <(curl https://raw.githubusercontent.com/hifiberry/hifiberry-dsp/master/install-dsptoolkit)

sigmatcpserver

This server runs in background and provides a TCP interface (port 8089) to access DSP functions. It is compatible with SigmaStudio. That means you can directly deploy DSP programs from SigmaStudio and change parameters online.

Command line utility

The dsptoolkit command is the main command line tool to communicate with the DSP TCP server. The command line parameters are documented in doc/dsptoolkit.md

REW integration

The software can be used to push filters created by Room Equalisation Wizard (REW) to the DSP. Have a look at the guide indoc/rew-basic.md

DSP profile format

DSP profiles can be generated directly in SigmaStudio. However, to enable the full potential of DSP Profiles and allow DSPToolkit to directly control the DSP program, you need to add some additional metadata to the XML file. The process to create a DSP profile is documented in doc/dspprofiles.md

hifiberry-dsp's People

Contributors

ahoeppner avatar ashtoncowie avatar bofrede avatar chatziko avatar edwardjarchibald avatar georgefst avatar growers12 avatar hftsai256 avatar hifiberry avatar makoto-tsudo avatar marecabo avatar market-arts avatar mesufesu avatar pinballpower avatar qerub avatar robislv avatar rphilbo avatar ssalonen avatar vincss avatar xomex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hifiberry-dsp's Issues

UnboundLocalError: local variable 'db' referenced before assignment

Traceback (most recent call last):
File "/usr/local/bin/dsptoolkit", line 29, in
cmdline.main()
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 1021, in main
self.command_mapcmd
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 653, in cmd_set_rew_filters_both
self.set_iir_filters(mode=MODE_BOTH, format=REW)
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 595, in set_iir_filters
self.dsptk.get_samplerate())
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/parser/rew.py", line 112, in readfilters
logging.info("Filter NO fc=%s", fc, db)
UnboundLocalError: local variable 'db' referenced before assignment

Some indicators in SigmaStudio not working.

Hello!

I've been trying to debug why some level indicators work real-time in sigmastudio while some do not, crashing the comms channel with sigmatcp or sigmastudio altogether.

I'm using;

  • RPi 3
  • Raspbian OS
  • HiFiBeffy DSP+ DAC
  • Sigmatcp from hifiberry-dsp
  • dspproj based on BeoCreate's Univeral dsprog, with which seems to work well except for this issue.

Thus far I've tested, with level Indicator switch ON;

Seem to work ok;

  • Level Detectors/Single Band/Running Average
  • Level Detectors/Multi Band/Pass Through

Do not work

  • All RMS Compressors
  • Level Detectors/Multi Band/RTA to Output

All other functionality of the cells work, meaning, compressors apply compression and allow you to adjust params, but if you flip the "Indicators On" switch the comms channel crashes after a couple of seconds.

I initially thought it might be overloading sigmatcp, causing the daemon to become unresponsive.

I stopped the service;
sudo systemctl stop sigmatcp
and started it from a terminal session;
/usr/local/bin/sigmatcpserver -v

After trying a few different things, based on the debug level output, I'm pretty sure the daemon was not overloaded. I had multiple "working" indicators and could still make live changes to other cell types (volume sliders, mutes).

I then forked the server and added some (rudimentary) read caching and additional log output;
https://github.com/joshzampino/hifiberry-dsp

Here's my instrumented handle_read output (a = addr, l: length, d: data);

A) A known good indicator (Running Average)

  1. DEBUG:root:received request type 10
  2. DEBUG:root:handle_read: a:41 l:4 d:b'\n\x00\x00\x00\x0e\x01\x00\x00\x00\x04\x00)\x00\x00'
  3. DEBUG:root:read_cache add: 41:bytearray(b'\x00JF#')
  4. DEBUG:root:Sending 18 bytes answer to client

B) A known bad indicator (Level Detectors/Multiple Bands/RTA to Output);

  1. DEBUG:root:received request type 10
  2. DEBUG:root:handle_read: a:37 l:4 d:b'\n\x00\x00\x00\x0e\x01\x00\x00\x00\x04\x00%\x00\x00'
  3. DEBUG:root:read_cache add: 37:bytearray(b'\x07\x00\x00\x00')
  4. DEBUG:root:Sending 18 bytes answer to client

C) Known bad indicator (Dynamics Processors/Multiband Compressor)

  1. DEBUG:root:received request type 10
  2. DEBUG:root:handle_read: a:340 l:4 d:b'\n\x00\x00\x00\x0e\x01\x00\x00\x00\x04\x01T\x00\x00'
  3. DEBUG:root:read_cache add: 340:bytearray(b'\x00\x00\x15\xd1')
  4. DEBUG:root:Sending 18 bytes answer to client
  5. DEBUG:root:received request type 10
  6. DEBUG:root:handle_read: a:341 l:4 d:b'\n\x00\x00\x00\x0e\x01\x00\x00\x00\x04\x01U\x00\x00\n\x00\x00\x00\x0e\x01\x00\x00\x00\x04\x01\\x00\x00'
  7. DEBUG:root:read_cache add: 341:bytearray(b'\x7f\xff\xff\xff')
  8. DEBUG:root:Sending 18 bytes answer to client

Looking at this output, I now think that the comms channel is crashing because the data offset or format is not what sigmastudio expects.

  1. Line A-3 and C-3 look healthy
  2. Line B-3 and C-7 are not what I would expect from a register value with an active signal
  3. C-3 and C-7 are two registers for the same compressor cell
  4. C-6 looks to have much more info than handle_read parses/uses

Before I dig in any further I wanted to check and see if this is something I'm missing in my configuration? I'm not very familiar with the DSP config and register values, perhaps there is an OS setting?

Please let me know if I can provide anymore detail, and thanks for looking.

beocreate v2.1 muted without "Selfboot" jumper

I don't know if this is the right place or if it's a bug in HiFiBerryOS see hifiberry/hifiberry-os#303 (comment) or is https://github.com/bang-olufsen/create a better place?!?

I have a beocreate (On the PCB has v2.1 printed on it) and run HiFiBerryOS v20220826

All channels are "muted" (No MUTE jumper is set). On the HiFiBerryOS web page, the DSP program was listed as "Unknown Program". I tried to install the "Beocreate Universal" program via web page, but it result always in "Unknown Program".

I also tied dsptoolkit install-profile /opt/beocreate/beo-dsp-programs/beocreate-universal-10.xml and create a /etc/hifiberry/config.fixed without success.

Work-a-round is to set the "Selfboot" jumper. After a reboot it worked (without a /etc/hifiberry/config.fixed)

Some information (with the working Selfboot jumper):

_______________________________________________________________
++ /opt/hifiberry/bin/check-system
HiFiBerryOS version: 20220826
Pi type: 3B
Pi model: Raspberry Pi 3 Model B Rev 1.2
Compatibility: No known problems
Sound card: Beocreate 4-Channel Amplifier
Sound card ID: 0
aplay 1: card 0 sndrpihifiberry [snd_rpi_hifiberry_dac]
aplay 2:  device 0 HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Mixer: DSPVolume
Features: pi pi3orlater arm7 dsp localui
Power controller: Error: Read failed
Error: Read failed
not detected
Linux version: Linux beocreate 5.15.56-v7 #1 SMP Thu Aug 25 10:09:45 UTC 2022 armv7l GNU/Linux
Date and time: Fri Oct 21 11:11:23 CEST 2022
eth0: 192.168.6.96
eth0: 192.168.6.52
/data mounted: OK
/dev/dri/card0: OK
BT devices: 
WiFi devices: wlan0
audiocontrol2: running
beocreate2: running
bluetooth: not running
bluealsa: running
bluealsa-aplay: running
dlnampris: not running
mpd: running
pigpio: running
raat: not running
shairport-sync: not running
sigmatcp: running
snapcastmpris: not running
spotify: running
squeezelite: not running
sshd: running
ympd: not running
weston: not running
cog: not running
_______________________________________________________________
++ /opt/hifiberry/bin/detect-hifiberry
Mounting /boot
Detecting using I2C
Could not find an I2C enabled sound card
Assuming HiFiBerry DAC+ Light, Zero
_______________________________________________________________
++ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
_______________________________________________________________
++ /opt/hifiberry/bin/readhat
no vendor:no product

Error on SigmaTCP-Server start after using the installscript on Raspbian light

Hi,

after using your suggested install script (https://raw.githubusercontent.com/hifiberry/hifiberry-dsp/master/install-dsptoolkit) this error occurs when trying to start sigmatcp:

/usr/local/bin/sigmatcpserver --alsa
Traceback (most recent call last):
  File "/usr/local/bin/sigmatcpserver", line 14, in <module>
    import hifiberrydsp.server.sigmatcp
  File "/usr/local/lib/python3.5/dist-packages/hifiberrydsp/server/sigmatcp.py", line 38, in <module>
    from hifiberrydsp.hardware.spi import SpiHandler
  File "/usr/local/lib/python3.5/dist-packages/hifiberrydsp/hardware/spi.py", line 36, in <module>
    class SpiHandler():
  File "/usr/local/lib/python3.5/dist-packages/hifiberrydsp/hardware/spi.py", line 46, in SpiHandler
    spi = init_spi()
  File "/usr/local/lib/python3.5/dist-packages/hifiberrydsp/hardware/spi.py", line 28, in init_spi
    spi.open(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

Any ideas? The install script did not give any errors. All requirements are met:

Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (9.0.1-2+rpt2).
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
Requirement already up-to-date: hifiberrydsp in /usr/local/lib/python3.5/dist-packages
Requirement already up-to-date: lxml in /usr/local/lib/python3.5/dist-packages (from hifiberrydsp)
Requirement already up-to-date: zeroconf in /usr/local/lib/python3.5/dist-packages (from hifiberrydsp)
Requirement already up-to-date: xmltodict in /usr/local/lib/python3.5/dist-packages (from hifiberrydsp)
Requirement already up-to-date: pyalsaaudio in /usr/local/lib/python3.5/dist-packages (from hifiberrydsp)
Requirement already up-to-date: spidev in /usr/local/lib/python3.5/dist-packages (from hifiberrydsp)
Requirement already up-to-date: netifaces!=0.10.5 in /usr/local/lib/python3.5/dist-packages (from zeroconf->hifiberrydsp)
Removed /etc/systemd/system/multi-user.target.wants/sigmatcp.service.
Created symlink /etc/systemd/system/multi-user.target.wants/sigmatcp.service → /lib/systemd/system/sigmatcp.service.

Thanks :)

No releases in years?

Why there is no new release for PyPi and in github?

The version in PyPi/github is 0.20 some 2y ago (Dec 24, 2020). Nevertheless, there's many fixes and improvements done in the repo since then.

Is there a reason why no new releases are made?

[Question] What it would take to support other boards

Hello,

I've been looking at beocreate board and in the process I stumbled upon this repo. I love what you did here to skip USBi and program AD's DACs directly.

This gives me an idea to fork / extend your repo to support other SigmaDSPs processors (maybe even SHARC range?).

From having a brief look at the code it seems you created a class with adau145x config. Am I right thinking that supporting for example ADAU1701 would be just a matter of creating another class with appropriate configuration or am I overlooking something?

To be clear I'm willing to do the work and open a PR :)

Thanks!

DSPVolume in Alsamixer not working

Initializing Sigma-Server gives this:

root@max2play:/home/pi# /usr/local/bin/sigmatcpserver --alsa
INFO:root:running as root, data will be stored in /var/lib/hifiberry
INFO:root:initializiong ALSA mixer control
No state is present for card ALSA
Found hardware: "bcm2835_alsa" "Broadcom Mixer" "" "" ""
Hardware is initialized using a generic method
No state is present for card ALSA
ERROR:root:can't create mixer named %s
ERROR:root:ALSA mixer DSPVolume not found
ERROR:root:ALSA mixer not available, aborting volume synchronisation
INFO:root:Announcing via zeroconf
INFO:root:Starting TCP server

The Alsamixer element DSPVolume exists but does not have any impact on volume. The setting of DSP-Profiles also doesn't seem to work.

Used default installer, spi enabled, dtoverlay=hifiberry-dac

Thanks!

AttributeError: 'int' object has no attribute 'readfilters' 0.18

Hi,
On 0.18 i receive these error when trying to apply filters:
Traceback (most recent call last):
File "/usr/local/bin/dsptoolkit", line 29, in
cmdline.main()
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 937, in main
self.command_mapcmd
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 579, in cmd_set_rew_filters_both
self.set_iir_filters(mode=MODE_BOTH, format=REW)
File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 557, in set_iir_filters
filters = REW.readfilters(self.args.parameters[0],
AttributeError: 'int' object has no attribute 'readfilters'

dacdsp-v12.dspproj missing in this repo

hifiberry-os currently includes updated dacdsp profile, version 12. This repository contains only the older version, v11, in sample_files/dspproj directory. Can we expect SigmaStudio profile version 12 to be added to this repo?

Reason for asking: I'm having trouble with TosLink In in v11 (both pre-compiled profile from hifiberry-os as well as source profile uploaded w/ SigmaStudio) - input detection block does not recognise incoming signal, even though there is a SPDIF-Lock and there is signal coming in, with severe volume). It works fine with dacdsp-v12.xml (included in hifiberry-os). Therefore, uploading a fixed project v12 here would be highly appreciated.

Wrong PROGRAM_END_SIGNATURE?

Hi,
I just stumbled upon the PROGRAM_END_SIGNATURE in

PROGRAM_END_SIGNATURE = b'\x02\xC2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
which is

02 C2 00 00 00 00 00 00 00 00 00 00

but the last bytes in

<action instr="writeXbytes" len="1118" addr="49152" AddrIncr="4" ParamName="Program" DspName="IC 1">00 00 00 02 0C 00 DC DC 0D 00 FF D2 0D 00 FF D0 0D 00 F4 50 0D 00 F4 00 C0 00 23 80 80 00 00 00 C0 00 23 00 80 00 00 00 C0 00 23 C0 80 00 00 20 C0 00 22 00 80 00 00 00 08 80 DC E0 0C 00 DC DC C0 00 20 00 80 00 00 29 0D 00 FF C1 C0 00 20 00 80 00 00 96 0D 00 FF C2 C0 00 20 00 80 00 00 8A 0D 00 FF C3 C0 00 20 00 80 00 00 01 0D 00 F4 62 C0 00 20 00 80 00 00 00 0D 00 F4 62 C0 00 20 00 80 00 00 0E 0D 00 FF D1 00 00 00 03 0D 00 FF D2 00 00 00 05 00 00 00 00 00 00 00 00 02 01 00 24 00 00 00 00 00 00 00 00 08 9E DC E0 00 00 00 00 C0 00 00 00 82 4F 00 20 08 8A DC E0 0A 21 00 26 00 8C 20 00 0A A5 00 25 02 09 00 3F C0 00 28 70 80 00 60 00 00 8C 11 91 00 00 00 23 00 00 00 00 30 00 BC E9 00 00 C2 F1 01 00 00 3E 06 00 40 14 36 40 50 15 26 40 40 15 09 2A 00 26 00 00 00 00 0C 82 00 39 C0 00 08 10 80 39 DC 30 32 01 00 50 00 00 00 00 0C 82 00 32 00 00 00 00 22 00 00 A3 20 00 00 00 2C 00 00 29 3C 00 00 30 3D 00 00 37 32 00 00 ED 30 00 00 00 3C 00 00 31 0D 00 00 3A 0C 82 00 34 C0 00 08 10 80 33 DC 30 22 01 00 5A C0 00 08 10 80 34 DC DC 02 00 00 E0 00 00 00 00 C0 00 08 10 80 33 DC DC C0 00 08 10 80 33 DC 30 0C 82 00 35 0A 21 00 35 22 01 00 79 C0 00 08 10 80 35 DC DC 0C 82 00 32 00 00 00 00 22 00 00 C6 00 00 00 00 0A A1 00 36 0A 25 00 3A 0A 29 DC 04 00 84 11 21 00 C4 E1 01 00 00 F2 89 00 85 28 08 2A A5 00 2D 20 94 18 89 C0 00 30 00 80 00 00 3C 09 00 0C 3C C0 00 08 0F 8F A4 00 3A 0B A2 FF A5 C0 00 08 0F 8F A6 00 37 0B 23 FF A7 02 00 00 D3 00 00 00 00 C0 00 08 10 80 33 DC DC C0 00 08 10 80 33 DC 30 0C 82 00 38 0A 21 00 38 22 01 00 84 C0 00 08 10 80 38 DC DC 02 00 00 F5 00 00 00 00 C0 00 08 10 80 33 DC DC 00 00 00 02 0C 10 F4 60 02 C2 00 00 00 00 00 00 09 80 0C 3D C0 00 00 00 82 0F 00 00 08 00 0C 3C 00 00 00 00 00 00 20 04 C0 00 0D 81 80 00 FF A8 09 00 0C 3C 08 80 0C 3D 02 C0 00 00 00 00 00 00 00 00 00 00 09 80 0C 3D C0 00 00 00 82 0F 00 00 08 00 00 3B 00 00 00 00 C0 00 0B 91 80 40 FF A8 09 00 00 3B 08 80 0C 3D 02 C0 00 00 00 00 00 00 00 00 00 00 0C 30 DC DC 0D 30 F5 10 C0 00 08 0F 8F A0 00 27 C0 00 08 0F 8F A1 00 28 C0 00 20 00 80 00 00 04 C0 00 08 0F 8F A4 00 29 C0 00 08 0F 8F A5 00 2C C0 00 08 0F 8F A6 00 2E 0D 01 FF A7 0C 00 FF A8 00 00 00 04 C0 00 20 00 80 00 00 00 0C 84 FF A2 0C 86 FF A3 02 19 00 B3 00 00 00 00 02 35 00 C0 0A 21 FF A8 0D 00 FF A2 0D 00 FF A3 02 C0 00 00 00 00 00 00 0C 00 DC DC 0D 00 FF A2 0D 00 FF A3 0D 01 FF A8 02 C0 00 00 00 00 00 00 00 00 00 00 C0 00 20 00 80 00 00 00 C0 00 20 40 80 00 00 01 0D 03 FF A4 C0 00 08 0F 8F A5 00 2B 0D 01 FF A7 02 00 00 D3 00 00 00 00 02 C0 00 00 00 00 00 00 C0 00 09 8F 8F A8 00 3C 00 00 00 04 0C 84 FF A2 0C 86 FF A3 02 19 00 D5 00 00 00 00 02 35 00 C0 0D 00 FF A2 0D 00 FF A3 0D 01 FF A8 02 C0 00 00 00 00 00 00 00 00 00 00 02 00 00 C6 00 00 00 00 0C 00 DC DC 0C 02 DC 80 0D 03 FF A4 C0 00 08 0F 8F A5 00 2A 0D 01 FF A7 02 00 00 D3 00 00 00 00 02 C0 00 00 00 00 00 00 0C 10 DC DC 0D 00 FF A0 0D 10 F5 12 C0 00 08 0F 8F A1 00 2F 02 C0 00 00 00 00 00 00 00 00 00 00 0A A1 00 36 0A 25 00 3A 0A 29 DC 04 00 84 11 21 00 C4 E1 01 00 00 F2 89 00 85 28 08 0C 82 00 32 00 00 00 00 2A A5 00 2C 20 94 18 89 C0 00 30 00 80 00 00 3C 09 00 00 3B C0 00 08 0F 8F A4 00 3A 0B A3 FF A5 C0 00 08 0F 8F A6 00 37 0B 23 FF A7 0C 00 FF A8 00 00 00 04 0C 84 FF A2 0C 86 FF A3 02 19 01 0A 00 00 00 00 02 35 00 C0 09 1E FF A2 09 1E FF A3 02 C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</action>
are

02 C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

What is the reason for that? Is this a bug or a feature?

Thanks,
Florian

genclocks.py will not release PCM resource until receives USR1

Once the default playback device is engaged with spdifclockgen service, it will lock out the device until receives signal USR1, which will potentially block other music streaming services from taking it over. E.g. Roon can no longer play through the device once the toslink is activated (e.g. from TV input), and even after the TV has turned off.

One way is to check if Roon/RAAT has exception hook that can invoke pause-all script whenever it fails to acquire the playback device. Another way is to poll the register value at 0xf600 periodically and close the playback resource when the lock is released.

Parameter control not working

Hello,

I followed the documentation on adding parameters by means of mergeparameters to my DSP profile .xml - this shall allow me to use volume control in the end.

For this purpose, my application includes a volume control slider, which was labeled "Volume". Indeed, mergeparameters correctly detects the volume control register:

$ mergeparameters blus_XT25TG-30_22W_4534G00_v1.xml blus_XT25TG-30_22W_4534G00_v1.params
added parameters to XML profile:
  volumeControlRegister

and adds it to the .xml correctly as well:

<?xml version="1.0" encoding="utf-8"?>
<ROM IC="ADAU1452" IC_Address="1" Address_byte_length="2">
        <beometa>
                <metadata type="volumeControlRegister">272</metadata>
        </beometa>
        <dateTime>2021-09-11T11:11:15.0679920Z</dateTime>
        <version>4.6.0.1812</version>
        <page modetype="Mode 0">
                <action instr="writeXbytes" len="4" addr="62464" AddrIncr="0" ParamName="IC 2.HIBERNATE" DspName="IC 2">00 01</action>
                <action instr="delay" ParamName="IC 2.Hibernate Delay" DspName="IC 2">00 FF</action>
// more code ...

Then, I load this file to my DSP with

dsptoolkit install-profile profile/blus_XT25TG-30_22W_4534G00_v1.xml

which works fine, and after

dsptoolkit reset

the application is correctly loaded from EEPROM and the DSP runs as expected.

Now the problem is that the volume control parameter cannot be used, as it says

$ dsptoolkit get-volume
Profile doesn't support volume control

Having a look at the logs for sigmatcp:

$ sudo service sigmatcp status
● sigmatcp.service - SigmaTCP Server for HiFiBerry DSP
   Loaded: loaded (/lib/systemd/system/sigmatcp.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2021-09-11 12:28:24 BST; 8min ago
 Main PID: 623 (sigmatcpserver)
    Tasks: 1 (limit: 1438)
   CGroup: /system.slice/sigmatcp.service
           └─623 /usr/bin/python3 /usr/local/bin/sigmatcpserver --alsa

Sep 11 12:29:20 raspberrypi sigmatcpserver[623]: INFO:root:writing XML file: b'<?xml version="1.0" encoding="utf-8"?>\n<ROM IC="ADAU1452" IC_Address="1" Address_byte_length="2">\n\t<beometa>\n\t\t<metadata type="volume
Sep 11 12:29:20 raspberrypi sigmatcpserver[623]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
Sep 11 12:29:20 raspberrypi sigmatcpserver[623]: D C0 00 08 0F 8D 84 00 FC C0 00 08 0F 8D 94 01 01 C0 00 00 18 82 80 1D BE C0 00 00 18 82 80 9D BE 0C 41 FD A0 00 10 80 41 0D 40 01 01 00 40 20 08 C0 00 00 10 82 CC 1D DE
Sep 11 12:29:20 raspberrypi sigmatcpserver[623]: INFO:root:preparing for memory update
Sep 11 12:29:48 raspberrypi sigmatcpserver[623]: INFO:root:finished memory update
Sep 11 12:29:49 raspberrypi sigmatcpserver[623]: INFO:root:caching program memory checksum
Sep 11 12:29:49 raspberrypi sigmatcpserver[623]: INFO:root:reading profile /var/lib/hifiberry/dspprogram.xml
Sep 11 12:30:07 raspberrypi sigmatcpserver[623]: ERROR:root:can't get attribute volumeControlRegister from XML

It cannot read the attribute from the XML. I checked the file /var/lib/hifiberry/dspprogram.xml, and it was correctly copied from my input .xml, so does contain the volumeControlRegister field.

What is the problem here?
Thanks in advance.

alsasync.py with pyalsaaudio 0.8+

I am using pyalsaaudio 0.9.0 and the --alsa part fails to get DSPVolume control.
According to the documentation, in 0.8 mixer routines introduced device argument, and if its (or cardid) not provided the routines fall back to 'default' card which is not our hifiberry board.
If the device name is the same across all hifiberry dsp boards then its easy to hardcode it.
See mesufesu@7cc2acd

Additionally, I think there is an indent mistake, because the code should not fail when we successfully create and obtain the mixer (mesufesu@417f199)

dsptoolkit get-samplerate returns default 48000 on dac2 hd + DSP

rpi3, dac2 hd + dsp
linux 5.10.78-2-osmc
dsptoolkit 0.20
dsp-addon-96-13.xml

dsptoolkit get-samplerate returns 48000Hz even though:

<?xml version="1.0" encoding="utf-8"?>
<ROM IC="ADAU1451" IC_Address="1" Address_byte_length="2">
        <dateTime>2020-12-08T12:44:00.3255070Z</dateTime>
        <version>4.5.0.1779</version>
        <beometa>
                <metadata type="sampleRate">96000</metadata>
                <metadata type="profileName">DSP add-on</metadata>
                <metadata type="profileVersion">13</metadata>

AttributeError: 'SigmaTCPClient' object has no attribute 'int_data'

Situation

  • I programmed the DSP with the profile 4way-iir-delay-mixer.dspproj using the instructions from dspprofiles.md
  • When calling dsptoolkit mute, this error message occurs, despite the installed xml file containing a muteRegister metadata field.
Traceback (most recent call last):
  File "/usr/local/bin/dsptoolkit", line 29, in <module>
    cmdline.main()
  File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 1009, in main
    self.command_map[cmd]()
  File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 720, in cmd_mute
    if self.dsptk.mute(True):
  File "/usr/local/lib/python3.7/dist-packages/hifiberrydsp/dsptoolkit.py", line 335, in mute
    mutereg, self.sigmatcp.int_data(1))
AttributeError: 'SigmaTCPClient' object has no attribute 'int_data'

Did you mean to use the int_data method from hifiberrydsp.datatools instead?

This issue was also reported in your support forum: https://support.hifiberry.com/hc/en-us/community/posts/360008393618/comments/360001138698

Left and right channels are reversed

After interchanging a lot of cables I found that the red output of the DAC+ DSP is the left channel and not the right channel, as is expected. If it this caused by the default profile, please supply a profile with the correct outputs.

enhancement to dsptoolkit -documentation

Tried to apply db -volumes with "dsptoolkit set-volume" following the documentation (/doc/dsptoolkit.md). There should be a mention for shortcircuiting negative db values with "--". Example below:

root@hifiberry:~# dsptoolkit set-volume -3db
dsptoolkit: error: unrecognized arguments: -3db

root@hifiberry:~# dsptoolkit set-volume '-3db'
dsptoolkit: error: unrecognized arguments: -3db

root@hifiberry:~# dsptoolkit set-volume -- -3db
Volume set to -3.0dB

Required on every boot

Since I first used this tool, I've found that I need to set it up again (e.g. run dsptoolkit install-profile https://raw.githubusercontent.com/hifiberry/hifiberry-dsp/master/sample_files/xml/dacdsp-default.xml) on every reboot in order to get any audio output from my DAC+ DSP.

This isn't too much of an inconvenience as I rarely reboot my Pi, but I'm just worried whether it's symptomatic of a more serious problem.

Pi 4, Raspbian Buster, Linux 4.19.97-v7l+

If the volume is set very low, the DAC+ DSP mutes

If the volume is set very low, the DSP mutes for a short moment and the green LED is off.
I installed the dsptoolkit and the default profile.

Is this a software configuration issue or a hardware issue?

dsptoolkit get-meta is broken: UnboundLocalError

# dsptoolkit get-meta
Traceback (most recent call last):
  File "/bin/dsptoolkit", line 29, in <module>
    cmdline.main()
  File "/usr/lib/python3.9/site-packages/hifiberrydsp/dsptoolkit.py", line 1049, in main
  File "/usr/lib/python3.9/site-packages/hifiberrydsp/dsptoolkit.py", line 748, in cmd_get_meta
UnboundLocalError: local variable 'attribute' referenced before assignment

It's v0.20 on HiFiBerryOS version: 20220826

# python
Python 3.9.7 (default, Aug 25 2022, 07:12:44) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hifiberrydsp
>>> hifiberrydsp.__version__
'0.20'

Cannot find DSPVolume when hifiberry is not the default alsa device (eg when running pulseaudio)

sigmatcpserver tries to open DSPVolume in the default alsa device. If hifiberry is not the default device, it fails with

ERROR:root:ALSA mixer DSPVolume not found"

and the alsa mixer becomes ususable (it does not control the DSP volume). Tested on pi4 with DAC+DSP.

This happens for instance if pulseaudio is running (default in recent Raspberry Pi OS), since a pulseaudio compatibility wrapper is set as the default alsa device.

Correct behaviour: when multiple alsa deviecs are present, sigmatcpserver should detect which is the hifiberry one.

Workaround: pulseaudio's wrapper alsa device can be disabled by commenting out the contents of /etc/alsa/conf.d/99-pulse.conf (this however means that a program cannot use alsa to output sound via pulseaudio).

mergeparameters AttributeError: 'dict' object has no attribute 'move_to_end'

Hello,
I am trying to use the merge tool for metadata, but i receive the following errors:

'''
pi@raspberrypi:~/phat $ mergeparameters dsc_phat.xml dsc_phat.params
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/hifiberrydsp/parser/xmlprofile.py", line 253, in update_metadata
beometa = self.doc["ROM"]["beometa"]
KeyError: 'beometa'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/mergeparameters", line 28, in
merge_params_main()
File "/usr/local/lib/python3.9/dist-packages/hifiberrydsp/parser/sigmaparams.py", line 236, in merge_params_main
params = pf.merge_params_into_xml(xmlfile)
File "/usr/local/lib/python3.9/dist-packages/hifiberrydsp/parser/sigmaparams.py", line 190, in merge_params_into_xml
xml.update_metadata(param_list)
File "/usr/local/lib/python3.9/dist-packages/hifiberrydsp/parser/xmlprofile.py", line 257, in update_metadata
self.doc["ROM"].move_to_end('beometa', last=False)
AttributeError: 'dict' object has no attribute 'move_to_end'
'''

Running python3.9 and and latest dsptoolkit from pip

DSPToolkit.set_filters off by one overwrites memory

DSPToolkit.clear_iir_filters() calls DSPToolkit.set_filters() with cutoff_long=True. I have a custom profile with only six filters, so length is 30 which means maxlen is 6. But the loop writing the data to memory will loop 7 times, causing data corruption:

        i = 0
        for f in filters:
            logging.debug(f)
            if mode == MODE_LEFT or mode == MODE_BOTH:
                if i < length_left:
                    self.sigmatcp.write_biquad(addr_left + i * 5, f)
            if mode == MODE_RIGHT or mode == MODE_BOTH:
                if i < length_right:
                    self.sigmatcp.write_biquad(addr_right + i * 5, f)
            i += 1
            if i > maxlen:
                break

Changing if i > maxlen to if i >= maxlen fixes the problem.

Buggy install-dsptoolkit script

  1. sudo apt-get install gcc-aarch64-linux-gnu needs to be added.
  2. reboot needed after running the script, otherwise sigmateltcp dies trying to open spi

No sound from hifiberry

Hi all,

I am very new to using a Raspberry Pi and have virtually no knowledge of programming.

I have successfully installed Jriver and am using it to play music via the Hifiberry digi pro + to my DAC. I would like to use Spotify on it too.

So I have downloaded raspotify and it is recognised as another device from my phone etc. That's a good start. I have read about selecting the Hifiberry as a device but I don't understand what I have to do. It mentions changing things in the config files but I don't know how to access these.
The OS I am using is Raspian
Can someone please talk me though how to do this, from the very basics?
Thanks
Dan

Missing metadata readSPDIFOnRegister in dsp profiles

I was trying to get my LG7450PLA with SoundSync to work with my DAC+DSP. It was quite fun to debug the problem (learning a bunch of new stuff!) and I think it's related to a variable/attribute/metadata not being set in the dsp profiles. In the sigmatcp logs I found the following:

LG Sound Sync: Using volume register at 4548 and SPDIF active register at None

Which means ATTRIBUTE_SPDIF_ACTIVE or readSPDIFOnRegister is undefined. I couldn't find readSPDIFOnRegister in any of the DSP profiles xml files, so I guess that must be it. I disabled checking for this register in soundsync.py and everything worked (well, after re-uploading my DSP profile, somehow the volume didn't change when the ALSA mixer changed...)

Unfortunately I have no idea what the value should be, otherwise I would have made a pull request. Sorry.

Display>Use Connected Display is broken by update to 20220228

Somewhere between hifiberryos-20211105-pi3.img and the update to 20220228 the feature has been broken.
Selecting the feature through the web interface turns on the display for ~1 second and then it goes off again, the checkbox in the control panel also reverts to unchecked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.