# My own USB DAC 'sound card'

**URL:** https://dietpi.com/forum/t/my-own-usb-dac-sound-card/3959
**Category:** General Discussion
**Created:** [26 March 2020 17:14 UTC](https://dietpi.com/forum/t/my-own-usb-dac-sound-card/3959 "2020-03-26T17:14:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![francolargo](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/f/dec6dc/32.png) [@francolargo](https://dietpi.com/forum/u/francolargo)
#### Post date: [26 March 2020 17:14 UTC](https://dietpi.com/forum/t/my-own-usb-dac-sound-card/3959/1 "2020-03-26T17:14:50Z")

</div>

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](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.

```nohighlight
root@DietPi:/# 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!

---

<div class="post-metadata">

### Author: ![WarHawk](https://dietpi.com/forum/user_avatar/dietpi.com/warhawk/32/21_2.png) [@WarHawk](https://dietpi.com/forum/u/WarHawk)
#### Post date: [27 March 2020 03:08 UTC](https://dietpi.com/forum/t/my-own-usb-dac-sound-card/3959/2 "2020-03-27T03:08:47Z")

</div>

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

[https://www.hifiberry.com/docs/archive/mixer-controls-on-the-hifiberry-boards/](https://www.hifiberry.com/docs/archive/mixer-controls-on-the-hifiberry-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%.

---

<div class="post-metadata">

### Author: ![francolargo](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/f/dec6dc/32.png) [@francolargo](https://dietpi.com/forum/u/francolargo)
#### Post date: [27 March 2020 06:35 UTC](https://dietpi.com/forum/t/my-own-usb-dac-sound-card/3959/3 "2020-03-27T06:35:57Z")

</div>

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
