Improve audio components by adding standardized configuration of external DAC with integrated PGA (Programmable Gain Amplifier)?
Describe the problem you have/What new integration you would like
Please look at adding standardized volume control configuration for external DACs with integrated PGA (Programmable Gain Amplifier).
Specifically, please consider adding a I2S config settings configuration standard for controlling of the digital volume control for DAC (Digital-to-Analog Converter) with integrated PGA (Programmable Gain Amplifier) using I2C commands for setting audio amplification level (i.e. the sound volume) to I2S config settings in ESPHome's the base i2s audio files . As well as also adding ability to get the current volume that has previously been set. Not only volume control for the voice assistant but also for media player when playing music. Guessing that some volume_multiplier functions/features or similar need to be added to both i2s audio speaker and i2s media player as a start?
- https://esphome.io/components/speaker/i2s_audio
- https://esphome.io/components/media_player/i2s_audio
External DAC with integrated PGA (Programmable Gain Amplifier) like example these Class-D amplifier (a.k.a. digital switching amplifier) hardware examples which ESPHome users already requested that need support for speaker volume control over i2s + i2c:
- ES8388
- https://github.com/esphome/esphome/pull/6956
- Also used on in the Raspiaudio Muse Luxe (ESP MUSE) and the Raspiaudio Radio.
- https://github.com/esphome/esphome/pull/6956
- MAX9744
- https://www.analog.com/en/products/max9744.html
- Also used on Adafruit's Stereo 20W Class D Audio Amplifier development board.
- https://www.analog.com/en/products/max9744.html
- TAS5805M (TAS5805MPWP/TAS5805MPWPR) DAC
- https://www.ti.com/product/TAS5805M
- DS4420
- https://www.analog.com/en/products/ds4420.html
- ES9038Q2M
- https://www.esstech.com/wp-content/uploads/2021/03/ES9038Q2M-Datasheet-v1.4.pdf
For more examples of DACs with integrated PGA suggest also check out these pages:
- https://www.analog.com/en/product-category/programmable-gain-amplifiers.html#products-in-category
- https://www.ti.com/amplifier-circuit/pga-vga/overview.html
- https://www.esstech.com/products-overview/digital-to-analog-converters/sabre-audiophile-dacs/
Note! Some of mentioned DACs also offer controls for advanced features such as enable or disable audio inputs/outputs, and more.
FYI, here are more related requests, PRs and projects/use-cases that requested i2s/i2c audio configurations for DAC in ESPHome:
- https://github.com/esphome/feature-requests/issues/1813
- https://github.com/esphome/feature-requests/issues/1751
- https://github.com/esphome/esphome/pull/6956
- https://github.com/esphome/feature-requests/issues/2619
- https://github.com/esphome/feature-requests/issues/2666
- https://github.com/HA-TB303/ESPHome-Louder-ESP32
- https://github.com/sonocotta/esp32-tas5805m-dac/
- https://www.espthings.io/louder-esp32
- https://www.youtube.com/shorts/yzx_xf33BAk
- https://www.espthings.io/louder-esp32
- https://github.com/sonocotta/esp32-tas5805m-dac/
- https://github.com/HA-TB303/ESPHome-Louder-ESP32
- https://github.com/esphome/feature-requests/issues/1750
- https://github.com/esphome/feature-requests/issues/1864
- https://github.com/esphome/esphome/pull/6062
- https://github.com/esphome/feature-requests/issues/2574
- https://github.com/esphome/feature-requests/issues/1874
- https://github.com/esphome/feature-requests/issues/1898
- https://github.com/esphome/feature-requests/issues/1875
- https://github.com/krzychb/dac-cosine
- https://github.com/esphome/feature-requests/issues/2125
- https://github.com/esphome/esphome/pull/5515
- https://github.com/esphome/esphome/pull/6062
Please describe your use case for this integration and alternatives you've tried:
The alternative to having a decided standard configuration for all is for all new developers to create their own custom configurations.
Additional context
Also see this similar feature request:
- https://github.com/esphome/feature-requests/issues/2619
Other than that there is by the way these improvements related to i2s audio configuration that are also currently being worked on:
- https://github.com/esphome/esphome/pull/7137 (currently being worked on by @nielsnl68)
- https://github.com/esphome/esphome/pull/7183 (currently being worked on by @nielsnl68)
- https://github.com/esphome/esphome/pull/7306 (currently being worked on by @pyos)
PS: Off-topic; there is btw also a request for USB UAC ( UAC 2.0 / UAC-2 ) USB Host Audio Driver support as well, which XMOS can do:
https://github.com/esphome/feature-requests/issues/2842 https://github.com/esp-arduino-libs/ESP32_USB_Stream/ https://components.espressif.com/components/espressif/usb_host_uac/versions/1.0.0 https://www.xmos.com/software/usb-audio/driver-support/
FYI, looks like @kbx81 might now be experimenting with concept of a audio_dac component and related components here:
- https://github.com/esphome/voice-kit/pull/59
Also see related new configuration and media player improvements:
- https://github.com/esphome/voice-kit/pull/63
- https://github.com/esphome/voice-kit/pull/67
- https://github.com/esphome/voice-kit/pull/62
- https://github.com/esphome/voice-kit/pull/75
- https://github.com/esphome/voice-kit/pull/76
- https://github.com/esphome/voice-kit/pull/75
Suspect he + @kahrendt plan more changes related to DACs + media player in the works so it sounds great, pun intended! 😀
FYI, gnumpi and + nielsnl68 a few other independent developers also seem to be working on different custom i2s_audio and adf_pipeline ESPHome audio components that will offer several enhancements that are all directly or indirectly related to ESPHome-based remote voice satellite and/or media player hardware that can be connected to Home Assistant:
- https://github.com/gnumpi/esphome_audio/tree/dev-next
(Looks like they are all currently working in his dev-next branch linked above. At least right now his dev-next branch is way ahead of the main branch in that repository at https://github.com/gnumpi/esphome_audio/tree/main so worth following both main branch and the dev-next branch until if and when those get submitted to upstream.).
And on top of that rwrozelle has started working on laying the groundwork for extending child components of Media Player in ESPHome (and Home Assistant) to allow ESPHome to be built with a much richer set of capabilities in the media_player. See:
- https://github.com/rwrozelle/audio-media-player
and
- https://github.com/esphome/aioesphomeapi/pull/911
- https://github.com/esphome/esphome/pull/7158
- https://github.com/esphome/esphome-docs/pull/4090
- https://github.com/home-assistant/core/pull/122799
FYI, just last night they moved the new audio decoder and resampling libraries from that experimental repository into their own separate repo that can be found here:
- https://github.com/esphome/esp-audio-libs
They also changed it in the experimental voice-kit repo so it outputs audio to a speaker component instead of directly writing to the I2S bus, (which in turn requires the merged changes in https://github.com/esphome/esphome/pull/7605) so make sure that you do not miss that important change:
- https://github.com/esphome/esphome/pull/7605
And the matching pull request to implement use of that in the "Home Assistant Voice PE" ("home-assistant-voice-pe") fork repo:
- https://github.com/esphome/home-assistant-voice-pe/pull/163
Also used as proof-of-concept in the nabu component in the kahrendt-i2s-audio-approach branch of home-assistant-voice-pe:
- https://github.com/esphome/home-assistant-voice-pe/tree/kahrendt-i2s-audio-approach
Suspect that they may potentially also make more refactoring changes that will scramble things around more before merging more from that experimental voice-kit repo into mainline ESPHome.
Hopefully splitting things like that while still keeping repos under the ESPHome originazation on GitHub will make it more readable and get more eyes on it + not as dounting to contribute upstream for mainlining.
FYI, Nabu Casa developers have as part of firmware for the Home Assistant Voice Preview Edition developed a brand new ”nabu” media player and other new audio custom component where most of that code will hopefully be pushed upstream to mainline ESPHome soon, see:
https://github.com/esphome/home-assistant-voice-pe/tree/dev/esphome/components/
And
https://www.home-assistant.io/blog/2024/12/19/voice-preview-edition-the-era-of-open-voice/
@sonocotta / @anabolyc do you plan to upstream your ESPHome driver changes to support built-in Home Assistant Integration?
- https://www.crowdsupply.com/sonocotta/esparagus-media-center/updates/esphome-driver-changes-to-support-home-assistant-integration-of-louder
That is, do you think you could try mainlining your DAC drivers that would allow native support for DAC components in ESHome?
-
https://github.com/sonocotta/esp32-tas5805m-dac
-
https://github.com/mrtoy-me/esphome-tas5805m
-
https://github.com/esphome/esp-audio-libs
That should benefit your project too if such changes was accepted in upstream ESPHome mainline as it would mean that ESPHome could nativly have built-in support for i2s stereo DACs like the PCM5100A, MAX98357, and TAS5805M you use in ESParagus Media Center and ESP32 Louder / ESP32 Loud, ESP32 Audio Docks, and Louder ESP boards from Sonocotta:
-
https://www.crowdsupply.com/sonocotta/esparagus-media-center
-
https://www.seeedstudio.com/Louder-ESP32-p-6401.html
-
https://sonocotta.com/louder-esp32/
-
https://www.elecrow.com/louder-esp32.html
-
https://sonocotta.github.io/esparagus-media-center/
- https://github.com/sonocotta/esparagus-media-center
-
https://sonocotta.github.io/esp32-audio-dock/
- https://github.com/sonocotta/esp32-audio-dock
PS: Bumping this again and asking since I think that the new "Resonate protocol" that the Open Home Foundation is working on for improving experience of streaming synchronized HiFi audio playback to multiple ESP32-based media player appliances + smart speakers will make the ESPHome firmware much more relevant for all different types Hi-Fi implementations:
- https://github.com/orgs/music-assistant/discussions/4200
Hey @Hedda
I would very much appreciate it TAS5805M driver would be accepted upstream. The thing is, I'm only the author of a bare driver implementation (based on esp-idf). I will update and extend it in the future, adding new features and adding TAS5825M support.
The author of the esphome component is @mrtoy-me, to whom I provided my support as well as I could. Due to the ESPHome project structure, this is a port of a subset of the bare driver implementation. We didn't find a way to implement it in a layered way, so technically these are two independent implementations.
I would do my best to support this initiative going forward, but I think it's not my call, but @mrtoy-me's to promote his driver to the ESPHome codebase.
As for the Resonate protocol, I'm paying close attention to it. I'm ready to support development with my boards (if that helps). I'm also curious to know if they would implement DSP functionalities at some level, as I'm planning to implement the possibility to send both TAP-filter and BQ-parameters directly to any of the DAC's EQ bands (30 of them!), which have the potential to build a personally customized speaker/room profile with a studio-level linearity, something that would sound in a few k$ range. It could be something unprecedented