Audio DAC is silent - running out of hair to pull out

Help needed figuring out why there’s no sound from the Adafruit PCM5102 DAC configured as I2S_Speaker, running on an Adafruit Feather32 Huzzah (a WROOM32-E, not a v2, not -C, etc).

The project is going to be a Cuckoo Clock, with on-device sounds played on a small speaker. I have a 2.5W amp downstream of the DAC output.

I’ve tried all the recipes and relevant previous posts here that I can find, but nothing changes.

The config:

# i2s_test.yaml

# using Adafruit PCM5102 DAC https://www.adafruit.com/product/6250
# created .h file by following https://esphome.io/guides/audio_clips_for_i2s/

i2s_audio: # https://esphome.io/components/i2s_audio/
  - id: i2s_audio_bus
    i2s_lrclk_pin: GPIO19
    i2s_bclk_pin: GPIO17

speaker: # https://esphome.io/components/speaker/i2s_audio/
  - platform: i2s_audio
    id: the_speaker
    i2s_audio_id: i2s_audio_bus
    i2s_dout_pin: GPIO16
    dac_type: external

button:
  - platform: template
    name: "Play Sound on Speaker"
    on_press:
      - logger.log: Speaker Button Pressed
      - speaker.mute_off:
          id: the_speaker
      - speaker.volume_set:
          id: the_speaker
          volume: 100%
      - speaker.play:
          id: the_speaker
          data: !lambda return timer_finished_raw;
  - platform: restart
    name: "Restart"
    id: button_restart
    internal: false

esphome:
  name: i2s_test
  includes:
    - cuckoo/timer_finished.h

esp32:
  # board: featheresp32
  variant: esp32
  framework:
    type: esp-idf

logger:
  baud_rate: 115200
  level: DEBUG
  logs:
    text_sensor: INFO
    sensor: INFO

ota:
  - platform: esphome
  - platform: web_server

wifi:
  min_auth_mode: WPA2
  fast_connect: false
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password

web_server:
  version: 3
  port: 80
  include_internal: true

api:

The log:

[D][button:022]: 'Play Sound on Speaker' Pressed.
[D][main:306]: Speaker Button Pressed
[D][i2s_audio.speaker:102]: Starting
[D][i2s_audio.speaker:106]: Started
[D][ring_buffer:034][speaker_task]: Created ring buffer with size 16000
[D][i2s_audio.speaker:111]: Stopping
[D][i2s_audio.speaker:116]: Stopped

I may have found the solution at the end of this post, which provides a way to simplify it all by relying (instead of on the speaker and raw audio) on the media_player and wav files.

https://community.home-assistant.io/t/i2s-audio-wont-play-all-raw-pcm-data/762194/17

The docs tell you how as always, biggest issue is finding the right doc.

Thanks for the pointer. I’d been all over that page many times, but never realizing its centrality to the subsystem.
If only there had been some kind of architectural guide around this subsystem, perhaps explaining that it works well to “chain a MediaPlayerSpeaker to a Speaker to an I2Sbus” and that piping direct audio into a Speaker no longer works as doc’d.

I agree its not made very clear, unless you know then it seems obvious.

With media player and voice stuff its always best to start with the code for the voice PE. This always gives you an idea of what is needed. The biggest issue now though just as you get it working is that the code is changing again with the new sendspin protocol.

I don’t know anything about the DAC you are using, but my code for media players can be found here it might help.

Thanks again.
I did start by looking at the HAVoice devices’ code. The one for the M5Atom, which I have a couple of, was first. It got me partway, but still nothing worked until I withdrew from trying to get speaker.play to work (figuring I didn’t really need a whole Media Player for a small sound-bite) and shifted to having the media_player play WAV files.
Even that didn’t work at first, but when I tried the config at the end of the post I linked above, suddenly it worked.
Now I’m puzzling over which thing was changed by that code that did the trick (i.e. compare with my previous configs), but mainly just glad to be past this hurdle.