My own USB DAC 'sound card'

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
francolargo
Posts: 2
Joined: Thu Mar 26, 2020 2:36 pm

My own USB DAC 'sound card'

Post by francolargo »

My first post here, so let me start by saying how much I like DietPi. Perfect for a "linux hobbyist" like myself.

I am an audio DIYer making a few very high resolution USB DACs (for myself and family only). I want to control (and sometimes stream-to) the DAC using the RPi and I'm now working on the system controls, which include I2C control of DAC chip registers. Squeezelite in DietPi is sounding very good! I have a specific question and a more general question, but they need a bit of background.

Background:
This DAC must be galvanically isolated so I have made my own RPi hat with all of the needed regulators and isolators to keep any noise from the RPi away from the circuits that touch the I2S stream. The USB front-end that makes the I2S stream is a galvanically isolated USB interface - http://jlsounds.com/i2soverusb.html. Now, my immediate goal is to control music volume using the DAC chip (which I know how to do via I2C), but I want the volume control within the squeezelite player interface to indicate the desired volume level.

My specific question:
I have successfully used the '-V Digital' option in squeezelite plus a 'softvol' plug in ALSA to control volume. [It works, but the signal quality obviously suffers.] Even though this works, I can't read the true volume setting using 'amixer'. It always reports as 100% even when system volume is much lower.

Code: Select all

[email protected]:/# amixer -c 1 sget 'Digital'
Simple mixer control 'Digital',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 255
  Front Left: 255 [100%]
  Front Right: 255 [100%]
So, how do I find the true working value of 'Digital' as set by Squeezelite?

My general question:
Is there a better way overall to have convenient control of music volume? If I *could* write my own 'sound card code', could I get access to the squeezelite 'Digital' volume parameter? Remember, I don't want ALSA nor Squeezelite to actually attenuate my signal - I will program the DAC chip (ES9038PRO) to do that. All I want Is to somehow 'read' Squeezelite's volume setting without it being applied in the usual way. I will then use that value in a different program that I will write. Within DietPi, I can't find nor edit the 'sound card' configuration files. Would working at the level of sound card configuration offer any advantages? If so, can someone point me the right direction?

That's it - Thanks for reading and I greatly appreciate any and all suggestions!

User avatar
WarHawk
Posts: 580
Joined: Thu Jul 20, 2017 7:55 am

Re: My own USB DAC 'sound card'

Post by WarHawk »

might be able to set the digital volume lower to prevent clipping

https://www.hifiberry.com/docs/archive/ ... ry-boards/
Controls of the cards
DAC+, Amp2

While there are a lot of mixer controls on the DAC+, you only need to care about one named “Digital”.

amixer sset PCM 90%

All other mixer control allow access to low-level functions of the sound chip, you won’t need them. Unfortunately it is not easy to remove these controls as they are part of a kernel driver that is not maintained by us. Just make sure the “Playback Boost” is set to 0%.

francolargo
Posts: 2
Joined: Thu Mar 26, 2020 2:36 pm

Re: My own USB DAC 'sound card'

Post by francolargo »

I'm not sure you understand. All I want to know is what level squeezelite THINKS the volume is set, depending on the volume slider in iPeng. Where can I find that variable, or state, or whatever? I'll use that number my own way in my own program.

TIA

Frank

Post Reply