esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
418 stars 26 forks source link

Add support for 24/32-bit audio, ES9038Q2M DAC #1875

Open nagyrobi opened 2 years ago

nagyrobi commented 2 years ago

Describe the problem you have/What new integration you would like Trying to use ESPHome I2S with ES9038Q2M, which seems to expect the data at 32 bits (default). Unfortunately audio is distorted and grabbled.

Please describe your use case for this integration and alternatives you've tried: High quality ESS board from Aliexpress, has 3 inputs, volume control, dithering filters, etc:

The board has an ATtiny24A-SSU microcontoller already on board, talking via I2C to the DAC, we can actually keep it and command this via GPIOs. We could of course replace it with an ESP32 and we could talk with the DAC directly from ESPHome, which would be exceptional, as the multitude of settings available in the DAC would be accessible to us - but that's more work to do...

Additional context Datasheet, see page 13.

Board schematic: ES9038 Board Schematic

Control with the onboard ATtiny24A MCU, if we don't wanna replace it: Audio input settings:

Filter settings are done with jumpers 3 tp 6: J3, J4, J5, J6 OFF, filter = apodizing fast roll-off filter

J3 OFF:

J3 ON:

Volume control: VOL: 1-2 short is muted, 2-3 short is connected to maximum volume Pin3 is 3.3V, Pin1 is GND, applying an analog output from ESP32 to Pin2, we can have volume control.

Hedda commented 2 months ago

FYI, stumbled on this new "voice-kit" GitHub repository where ESPHome and Home Home Assistant developers from Nabu Casa are developing new or improved components for I2S audio (XMOS) support and a new native media player with support for FLAC, WAV/PCM, etc. for the upcoming voice-kit hardware from Nabu Casa:

Note that I'm only paraphrasing but one of the representatives that is working on that "voice-kit"project more or less wrote there that while ESPHome and Home Assistant voice developers from Nabu Casa are now focusing to work on voice assistant features they are still figuring all this around making use of external audio processors and while they are currently only testing the XMOS xCORE chip as a candidate for an ESPHome-based voice-kit reference hardware design for official Home Assistant Voice Assistant development kit they also plan to work on "audio processor" component for ESPHome with hardware-independent architecture that will not be reliant on specific hardware configurations or dependent specifically on the XMOS xCORE DSP chip but instead allow others to add support for additional DSPs as audio processors (i.e. sound co-processors) in the future, (plus the fact that they will make it so that all the I2S settings and pins are still configurable in YAML, meaning that it should at least be possible add support for DSP types to the "audio processor" component if they work similar to XMOS xCORE DSP chips, as well as different board designs that uses other I2S settings and pins). That representative also wrote; "we will add all the code to the base ESPHome project once things are stable and working well".m and noted that ESPHome and Home Assistant / Nabu Casa developers are right now moving very fast and breaking things as they go so working on code for the new voice-kit related components for ESPHome in a separate repository on GitHub here:

Anyway, they already added new experimental features and functions or improvements/enhancements to ESPHome, such as:

They also have many TODO inline coments in the code there if anyone are interested in helping them:

https://github.com/search?q=repo%3Aesphome%2Fvoice-kit%20todo&type=code

Note! Be aware that there are many comments there to that most of the new stuff are not yet stable.