there is no such a code in ESPHome to separate left and right channels with external DAC unfortunatelly. Stereo signal carry signal separation so LRCLK can understand which channel it should decode and play.
As far as I understood, the problem might be with ESPHome itself. I might be wrong.
UPDATE: Figured out stereo output. Problem was in MAX98357A configuration. By default it is configured to mix outputs using 1M resistor (to VDD) so to configure it to left and right channels, SD needs to be pulled-up to VDD with jumper (0 Ohms) that is going to be LEFT channel and with 370-470K resistor to VDD to output Right channel.
All perfect now.
By the way I get really nice sound quality despite this is only class D amplifier.
and here is my little project printed for stereo WiFi player ))
and here is my code:
captive_portal:
status_led:
pin:
number: GPIO2
inverted: true
i2s_audio:
- id: i2s_out
i2s_lrclk_pin: GPIO14
i2s_bclk_pin: GPIO27
- id: i2s_in
i2s_lrclk_pin: GPIO32 #ws
i2s_bclk_pin: GPIO33 #sck
# LR to be grounded
media_player:
- platform: i2s_audio
name: ESPHome I2S Media Player
dac_type: external
i2s_audio_id: i2s_out
i2s_dout_pin: GPIO25
mode: stereo
# Example configuration entry
microphone:
- platform: i2s_audio
i2s_audio_id: i2s_in
i2s_din_pin: GPIO26 #sd
adc_type: external
id: mic_i2s
pdm: false
voice_assistant:
microphone: mic_i2s

