Regarding DAC installation on balenaSound project

Hello,

My name is Chris, and I worked the balenaSound project to give old hifi stereos bluetooth compatability. Great project and I loved working it. I also decided to
install a DAC as well because I enjoy audio fidelity. However it was here that I ran into some issues.

First and foremost I was able to work the problem. It goes as such; when installing the DAC there needs to be some config changes. It is specified that the
BALENA_HOST_CONFIG_dtoverlay = hifiberry-dac did not work for the IQ Audio DAC+ that I specc’ed for this project. Instead I needed to set the dtoverlay parameter to
iqaudio-dacplus which took some digging to find but I got it eventually.

This brings me to my actual point: I believe the balenaSound project should be updated to reflect differences in DAC devices and should include some type of blurb about how
different DAC devices may require a different parameter than the one specified. Below is a link covering the dtoverlay parameters for IQ Audio’s various DAC devices. I’m sure
there are more out there that have yet to be found. The aim of this thread is to provide discourse on this particular change and I invite all to discuss the implications,
good and bad, of such a change. Thank you for your time.

TL;DR I believe the balenaSound project should be updated to reflect differences in DAC devices.

IQ Audio Config Guide

Hey Chris, thanks for this post. I am happy to hear you had fun with balenaSound and were able to get the DAC working. I think its a great idea to document this in the balenaSound project, feel free to open an issue or, who knows even a PR :P, to https://github.com/balena-io-projects/balena-sound so the project maintainer can chime in with some feedback and pointers.

@clevertanooki, this would be great.
I am using a Suptronics X400 board and have similar problems.
Do you know what the correct setting for that board might be?
I found this page from the Volumio project - https://github.com/volumio/Volumio2/blob/master/app/plugins/system_controller/i2s_dacs/dacs.json

In Volumio my device uses the settings:

{"id":"st400-dac-amp","name":"ST400 Dac (PCM5122) - Amp","overlay":"iqaudio-dacplus","alsanum":"1","mixer":"Digital","modules":"","script":"","needsreboot":"yes"},

but that doesn’t seem to work.

Would love to get this working soon, I have a party at the weekend and need the tunes!

Update:
I have fixed this by also using iqaudio-dacplus in place of hifiberry-dac.
I have added a page to the project documentation to record these settings for different projects.

Another update - the value iqaudio-dacplus works, but when I turn the volume up it stops working!

Hey @peteretep I was just reviewing your PR as well (thanks again for that contribution!), there’s some issue with the CI but we’ll get it resolved.

I am assuming you don’t have that issue when running Volumio. We can look at getting a unit to test the project with but in the meantime it would be interesting to know if your unit works OK on Raspbian? Is it literally as soon as you volume up one ‘click’ the output stops? Another thing you could try is copying the dtoverlay to the overlays folder on the boot partition from here, just in case there have been any updates: https://github.com/raspberrypi/firmware/tree/master/boot/overlays

Thanks Chris. Still trying to pin this one down.
I have experienced the same issue in Volumio when I use the Iqaudio settings but they went away when I selected the ST400 settings.

IQaudio settings:
{"id":"iqaudio-dacplus","name":"IQaudIO DAC Plus","overlay":"iqaudio-dacplus,unmute_amp ","alsanum":"1","mixer":"Digital","modules":"","script":"iqamp-unmute.sh","i2c_address":"4c","needsreboot":"no"},

ST-400 settings:
{"id":"st400-dac-amp","name":"ST400 Dac (PCM5122) - Amp","overlay":"iqaudio-dacplus","alsanum":"1","mixer":"Digital","modules":"","script":"","needsreboot":"yes"},

Changing the settings between the two also involved a reboot - I haven’t discounted the possibility that sometimes it boots correctly and sometimes with this issue.

I currently have the system working on balena-sound with the dtoverlay set to "iqaudio-dacplus,24db_digital_gain". I’ll check it again tomorrow to see if it is still working correctly, and then cycle the power a few times to see if it stays working correctly.

When the issue is happening, any sounds over a certain volume will be cut off. It doesn’t matter if I increase the sound by turning up the volume in my phone’s spotify, the alsamixer or the hardware knob on the DAC.

Thanks for the update Peter, we’re interested to hear how you get on. When you describe it like that it does sound like a gain thing, like somethings being clipped at some point in the chain. Keep us posted! Ensuring other DACs work is something we’re keen to maintain on the project, but there are so many out there, so contributions from users like yourself are very much appreciated.

Looks like this issue is unrelated to balena sound. Happening in volumio to the same extent. I need to keep cycling the power until it works correctly. Can’t find any pattern. No idea where to look now.
Pretty sure the 24db_digital_gain setting isn’t doing anything.

Just tried with a fresh installation of Raspbian.
I ran speaker-test and had full control of the expected volume range.
Could this be an issue with the base image?
I see the spotify client is using a pi3 image rather than a pi4?
FROM balenalib/raspberrypi3:buster

Hi @peteretep

I just want to confirm which Raspberry Pi model you’re using with your Suptronics X400?

Kind regards
Alida

It’s a pi4

Thanks for the info.

Talking to the HW Hacker team who put out these sample projects, we’re looking at building a supported list of DACs which we have tested internally, as well as customer tested ones. That doesn’t help you today, but I think it’s worth while bearing in mind before you go too deep down the rabbithole diagnosing this.

I would suggest, from personal experience, that you try to make a simple example with a speaker test app and the try to nail down the difference between the working and non-working setups. Also, it might be worth pulling the DTBO files from the Raspbian image for Pi4 incase they are newer than the ones in balenaOS… it’s worth a shot.

@peteretep in addition to what Rich says, you can try this branch: https://github.com/balenalabs/balena-sound/tree/set-digital-volume

I was working tonight with some other DACs, and found that one was insanely, off the charts loud. You could try using alsamixer within the terminal to reduce the output level, or use the SYSTEM_OUTPUT_VOLUME env var (with the code from this branch) to reduce the digital volume level. I needed to do this for the Justboom DAC HAT but not for the Blokas Pisound. I wonder if it could be this extremely high volume level that’s causing yours to cut out.

Thanks @chrisys . I played around with the alsa mixer levels and it doesn’t seem to be related to that. Will play more though.

Thanks @richbayliss, can you give me a pointer on where to get the DTBO files and where to put them?

Hi. For info on DTBO files (also applies to balenaOS) you can take a look at: https://www.raspberrypi.org/documentation/configuration/device-tree.md. If you’re interested, we have an example of dynamic DT patching here: https://github.com/balena-io-playground/balena-logging-sensors/tree/master/part_1.

Please update us if you make progress on that.

I’ve moved back to using a Pi3 and it seems to be working fine, had to increase the SYSTEM_VOLUME_LEVEL back to 100% after your most recent changes though.
Looks like the documentation on SYSTEM_VOLUME_LEVEL is now incorrectly saying it is default to 100%

That’s right, I’ll update the documentation right away.

Hi guys,

Quick note: I have the same DAC and had to add the ‘unmute_amp’ option to the BALENA_HOST_CONFIG_dtoverlay setting to get my board working.

iqaudio-dacplus,unmute_amp

Also: awesome project, loving it ;p

Thx @br3wal for letting us know about the fix and glad you found it :slight_smile: