S3 Media Player

I am at my wits end with this one. I have tried everything I could find here but I am not getting any audio out of my speaker.

It’s an esp32 s3 n16r8 with a PCM5102 DAC

Here is my current config.

esphome:
  name: creative-d80
  friendly_name: creative-d80
  platformio_options:
    board_build.flash_mode: dio

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options:
      CONFIG_ESP32_S3_BOX_BOARD: "y"

psram:
  mode: octal
  speed: 80MHz

external_components:
  - source:
      type: git
      url: https://github.com/gnumpi/esphome_audio
      ref: dev-next
    components: [ adf_pipeline, i2s_audio ]
    refresh: 0s

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  - platform: esphome
    password: ""

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Creative-D80 Fallback Hotspot"
    password: ""

captive_portal:

i2s_audio:
  - id: i2s_out
    i2s_lrclk_pin: GPIO05
    i2s_bclk_pin: GPIO04

adf_pipeline:
  - platform: i2s_audio
    type: audio_out
    id: adf_i2s_out
    i2s_audio_id: i2s_out
    i2s_dout_pin: GPIO18

media_player:
  - platform: adf_pipeline
    id: adf_media_player
    name: adf_media_player
    internal: false
    keep_pipeline_alive: true
    pipeline:
      - self
      - adf_i2s_out

Current log (it used to fully start before I switch to this external library now it doesn’t)

INFO ESPHome 2024.7.3
INFO Reading configuration /config/esphome/creative-d80.yaml...
INFO Updating https://github.com/gnumpi/esphome_audio@dev-next
INFO Starting log output from 192.168.107.145 using esphome API
INFO Successfully connected to creative-d80 @ 192.168.107.145 in 0.045s
INFO Successful handshake with creative-d80 @ 192.168.107.145 in 0.057s
[09:47:50][I][app:100]: ESPHome version 2024.7.3 compiled on Aug 12 2024, 08:28:57
[09:47:50][C][wifi:599]: WiFi:
[09:47:50][C][wifi:427]:   Local MAC: 74:4D:BD:7F:CD:D8
[09:47:50][C][wifi:432]:   SSID: [redacted]
[09:47:50][C][wifi:435]:   IP Address: 192.168.107.145
[09:47:50][C][wifi:439]:   BSSID: [redacted]
[09:47:50][C][wifi:440]:   Hostname: 'creative-d80'
[09:47:50][C][wifi:442]:   Signal strength: -50 dB ▂▄▆█
[09:47:50][C][wifi:446]:   Channel: 6
[09:47:50][C][wifi:447]:   Subnet: 255.255.255.0
[09:47:50][C][wifi:448]:   Gateway: 192.168.107.1
[09:47:50][C][wifi:449]:   DNS1: 1.1.1.1
[09:47:50][C][wifi:450]:   DNS2: 9.9.9.9
[09:47:50][C][logger:185]: Logger:
[09:47:50][C][logger:186]:   Level: DEBUG
[09:47:50][C][logger:188]:   Log Baud Rate: 115200
[09:47:50][C][logger:189]:   Hardware UART: USB_CDC
[09:47:50][C][psram:020]: PSRAM:
[09:47:50][C][psram:021]:   Available: YES
[09:47:50][C][psram:024]:   Size: 8191 KB
[09:47:50][C][captive_portal:088]: Captive Portal:
[09:47:50][C][mdns:116]: mDNS:
[09:47:50][C][mdns:117]:   Hostname: creative-d80
[09:47:50][C][esphome.ota:073]: Over-The-Air updates:
[09:47:50][C][esphome.ota:074]:   Address: creative-d80.local:3232
[09:47:50][C][esphome.ota:075]:   Version: 2
[09:47:50][C][esphome.ota:078]:   Password configured
[09:47:50][C][safe_mode:018]: Safe Mode:
[09:47:50][C][safe_mode:020]:   Boot considered successful after 60 seconds
[09:47:50][C][safe_mode:021]:   Invoke after 10 boot attempts
[09:47:50][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[09:47:50][C][api:139]: API Server:
[09:47:50][C][api:140]:   Address: creative-d80.local:6053
[09:47:50][C][api:142]:   Using noise encryption: YES
[09:47:50][C][audio:225]: Audio:
[09:47:50][C][audio:247]:   External DAC channels: 2
[09:47:50][C][audio:248]:   I2S DOUT Pin: 18

I have an Esphome media player using one of these

and a MAX98357A This is directly connected to a speaker in a 1956 valve radio.

This is the code I use.

substitutions:
  node_name: wireless


esphome:
  name: ${node_name}
  friendly_name: ${node_name}
  platformio_options:
    board_build.flash_mode: dio

external_components:
  - source:
      type: git
      url: https://github.com/gnumpi/esphome_audio
      ref: main
      #type: local
      #path: /Users/siekmann/Privat/Projects/espHome/esphome_audio/esphome/components
    components: [ adf_pipeline, i2s_audio ]

esp32:
  board: esp32-s3-devkitc-1
  variant: ESP32S3
  flash_size: 16MB
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options:
      # need to set a s3 compatible board for the adf-sdk to compile
      # board specific code is not used though
      CONFIG_ESP32_S3_BOX_BOARD: "y"

      CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM: "16"
      CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM: "512"
      CONFIG_TCPIP_RECVMBOX_SIZE: "512"

      CONFIG_TCP_SND_BUF_DEFAULT: "65535"
      CONFIG_TCP_WND_DEFAULT: "512000"
      CONFIG_TCP_RECVMBOX_SIZE: "512"

logger:

psram:
  mode: quad
  speed: 80MHz

wifi:
  ssid: !secret wifi_ssid_4
  password: !secret wifi_password_4


api:
  encryption:
    key: "6hyX44qziT/bxX9q6Y8tJm2fC/3lOVbXBztQX10r6co="

ota:
  - platform: esphome
    password: "20f042bddb3474f6ba97541628e789f1"

button:
  - platform: restart
    id: reboot
    name: "Reboot"

i2s_audio:

  - id: i2s_out
    i2s_lrclk_pin: GPIO11
    i2s_bclk_pin: GPIO9

adf_pipeline:
  - platform: i2s_audio
    type: audio_out
    id: adf_i2s_out
    i2s_audio_id: i2s_out
    i2s_dout_pin: GPIO7

media_player:
  - platform: adf_pipeline
    id: adf_media_player
    name: player
    keep_pipeline_alive: false
    internal: false
    pipeline:
      - self
      - adf_i2s_out

light:
  - platform: esp32_rmt_led_strip
    rgb_order: RGB
    pin: GPIO6
    num_leds: 2
    rmt_channel: 0
    chipset: WS2812
    name: ${node_name} LED
    id: led
    disabled_by_default: false
    #entity_category: diagnostic
    icon: mdi:led-on
    default_transition_length: 0s
    effects:
      - pulse:
          name: "Slow Pulse"
          transition_length: 250ms
          update_interval: 250ms
          min_brightness: 20%
          max_brightness: 100%
      - pulse:
          name: "Fast Pulse"
          transition_length: 100ms
          update_interval: 100ms
          min_brightness: 20%
          max_brightness: 100%

web_server:
  port: 80

I then play media and radio via Music Assistant. Its been mostly trouble free for months now.

Here is the new config, still not working. I can hear it trying and then it appears to crash. I assume I have to hook it up to computer so I can read logs instead of wireless?

esphome:
  name: creative-d80
  friendly_name: creative-d80
  platformio_options:
    board_build.flash_mode: dio

esp32:
  board: esp32-s3-devkitc-1
  variant: ESP32S3
  flash_size: 16MB
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options:
      # need to set a s3 compatible board for the adf-sdk to compile
      # board specific code is not used though
      CONFIG_ESP32_S3_BOX_BOARD: "y"

      CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM: "16"
      CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM: "512"
      CONFIG_TCPIP_RECVMBOX_SIZE: "512"

      CONFIG_TCP_SND_BUF_DEFAULT: "65535"
      CONFIG_TCP_WND_DEFAULT: "512000"
      CONFIG_TCP_RECVMBOX_SIZE: "512"

psram:
  mode: octal
  speed: 80MHz

external_components:
  - source:
      type: git
      url: https://github.com/gnumpi/esphome_audio
      ref: dev-next
    components: [ adf_pipeline, i2s_audio ]
    refresh: 0s

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  - platform: esphome
    password: ""

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Creative-D80 Fallback Hotspot"
    password: ""

captive_portal:

i2s_audio:
  - id: i2s_out
    i2s_lrclk_pin: GPIO05
    i2s_bclk_pin: GPIO04

adf_pipeline:
  - platform: i2s_audio
    type: audio_out
    id: adf_i2s_out
    i2s_audio_id: i2s_out
    i2s_dout_pin: GPIO18

media_player:
  - platform: adf_pipeline
    id: adf_media_player
    name: adf_media_player
    internal: false
    keep_pipeline_alive: false
    pipeline:
      - self
      - adf_i2s_out

And I am getting logs now after I plug it back in.

10:46:16][D][api.connection:1375]: Home Assistant 2024.7.3 (192.168.0.50): Connected successfully
[10:47:01][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[10:47:01][D][esp32.preferences:114]: Saving 1 preferences to flash...
[10:47:01][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[10:47:26][D][media_player:061]: 'media player' - Setting
[10:47:26][D][media_player:068]:   Media URL: http://192.168.0.50:8097/flow/media_player.creative_d80_media_player/c655dd5790dd4af5bfe221351e45d0fd.mp3?ts=1723474046
WARNING creative-d80 @ 192.168.107.145: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for creative-d80 @ 192.168.107.145
WARNING Disconnected from API
INFO Successfully connected to creative-d80 @ 192.168.107.145 in 0.005s
INFO Successful handshake with creative-d80 @ 192.168.107.145 in 0.069s
[10:47:56][D][api:102]: Accepted 192.168.0.50
[10:47:56][D][api.connection:1375]: Home Assistant 2024.7.3 (192.168.0.50): Connected successfully

Some progress

[10:59:07][D][media_player:061]: 'media_player' - Setting
[10:59:07][D][media_player:068]:   Media URL: http://192.168.0.50:8097/single/media_player.creative_d80_media_player/5a9440b89d4a48a78cda309c7a154632.mp3?ts=1723474747
[10:59:07][D][esp_audio_sources:098]: Set new uri: http://192.168.0.50:8097/single/media_player.creative_d80_media_player/5a9440b89d4a48a78cda309c7a154632.mp3?ts=1723474747
[10:59:07][D][adf_media_player:057]: Got control call in state IDLE
[10:59:07][D][adf_media_player:058]: req_track stream uri: http://192.168.0.50:8097/single/media_player.creative_d80_media_player/5a9440b89d4a48a78cda309c7a154632.mp3?ts=1723474747
[10:59:07][D][esp_adf_pipeline:060]: Starting request, current state UNINITIALIZED
[10:59:07][D][esp_adf_pipeline:448]: [MediaPlayer] Pipeline changed from UNINITIALIZED to INITIALIZING. (REQ: 0)
[10:59:07][I][adf_media_player:192]: got new pipeline state: 1, while in MP state IDLE
[10:59:07][I][adf_media_player:256]: current mp state: IDLE
[10:59:07][I][adf_media_player:257]: anouncement: false
[10:59:07][I][adf_media_player:258]: play_intent: false
[10:59:07][I][adf_media_player:259]: current_uri_: yes
[10:59:07][D][esp-idf:000]: I (229754) MP3_DECODER: MP3 init

[10:59:07][D][i2s_audio:067]: Install driver requested by Writer
[10:59:07][D][esp-idf:000]: I (229758) I2S: DMA Malloc info, datalen=blocksize=2048, dma_buf_count=4

[10:59:07][D][i2s_audio:073]: Installing driver : yes
[10:59:07][D][esp_adf_pipeline:497]: pipeline tag 0, http
[10:59:07][D][esp_adf_pipeline:497]: pipeline tag 1, decoder
[10:59:07][D][esp_adf_pipeline:497]: pipeline tag 2, i2s_out
[10:59:07][D][esp-idf:000]: I (229767) AUDIO_PIPELINE: link el->rb, el:0x3d800a30, tag:http, rb:0x3d800f94

[10:59:07][D][esp-idf:000]: I (229769) AUDIO_PIPELINE: link el->rb, el:0x3d800c2c, tag:decoder, rb:0x3d801fd4

[10:59:07][D][esp_adf_pipeline:507]: Setting up event listener.
[10:59:07][D][esp_adf_pipeline:448]: [MediaPlayer] Pipeline changed from INITIALIZING to CREATED. (REQ: 0)
[10:59:07][I][adf_media_player:192]: got new pipeline state: 2, while in MP state IDLE
[10:59:07][I][adf_media_player:256]: current mp state: IDLE
[10:59:07][I][adf_media_player:257]: anouncement: false
[10:59:07][I][adf_media_player:258]: play_intent: false
[10:59:07][I][adf_media_player:259]: current_uri_: yes
[10:59:07][D][esp_adf_pipeline:448]: [MediaPlayer] Pipeline changed from CREATED to PREPARING. (REQ: 0)
[10:59:07][I][adf_media_player:192]: got new pipeline state: 3, while in MP state IDLE
[10:59:07][D][adf_i2s_out:141]: Set final i2s settings: 16000
[10:59:07][I][adf_media_player:256]: current mp state: PLAYING
[10:59:07][I][adf_media_player:257]: anouncement: false
[10:59:07][I][adf_media_player:258]: play_intent: false
[10:59:07][I][adf_media_player:259]: current_uri_: yes
[10:59:07][D][esp_audio_sources:103]: Prepare elements called (initial_call)!
[10:59:07][D][esp_audio_sources:137]: Use fixed settings: no
[10:59:07][D][esp_audio_sources:138]: Streamer status: 1
[10:59:07][D][esp_audio_sources:139]: decoder status: 1
[10:59:07][D][esp_audio_sources:140]: stream uri: http://192.168.0.50:8097/single/media_player.creative_d80_media_player/5a9440b89d4a48a78cda309c7a154632.mp3?ts=1723474747
[10:59:07][D][adf_audio_element:108]: Preparing [http]...
[10:59:07][D][esp-idf:000]: I (229809) AUDIO_THREAD: The http task allocate stack on external memory

[10:59:07][D][esp-idf:000]: I (229810) AUDIO_ELEMENT: [http-0x3d800a30] Element task created

[10:59:07][D][adf_audio_element:108]: Preparing [decoder]...
[10:59:07][D][esp-idf:000]: I (229813) AUDIO_THREAD: The decoder task allocate stack on external memory

[10:59:07][D][esp-idf:000]: I (229815) AUDIO_ELEMENT: [decoder-0x3d800c2c] Element task created

[10:59:07][D][adf_audio_element:108]: Preparing [i2s_out]...
[10:59:07][D][esp-idf:000]: I (229820) AUDIO_ELEMENT: [i2s_out-0x3d800dfc] Element task created

[10:59:07][D][adf_audio_element:165]: Resuming [http]...
[10:59:07][D][adf_audio_element:172]: [http] Sending resume command.
[10:59:07][D][adf_audio_element:165]: Resuming [decoder]...
[10:59:07][D][adf_audio_element:172]: [decoder] Sending resume command.
[10:59:07][D][esp-idf:000][decoder]: I (229859) AUDIO_ELEMENT: [decoder] AEL_MSG_CMD_RESUME,state:1

[10:59:08][D][esp-idf:000][decoder]: I (229861) MP3_DECODER: MP3 opened

[10:59:08][D][adf_audio_element:191]: [http] Checking State, got 72
[10:59:08][D][adf_audio_element:191]: [decoder] Checking State, got 72
[10:59:13][E][esp_adf_pipeline:246]: Timeout while PREPARING. Stopping pipeline!
[10:59:13][D][esp_adf_pipeline:448]: [MediaPlayer] Pipeline changed from PREPARING to ABORTING. (REQ: 1)
[10:59:13][I][adf_media_player:192]: got new pipeline state: 10, while in MP state PLAYING
[10:59:13][I][adf_media_player:256]: current mp state: PLAYING
[10:59:13][I][adf_media_player:257]: anouncement: false
[10:59:13][I][adf_media_player:258]: play_intent: false
[10:59:13][I][adf_media_player:259]: current_uri_: yes
[10:59:13][D][adf_audio_element:324]: [http] Checking State for stopping, got 2
[10:59:13][D][adf_audio_element:324]: [decoder] Checking State for stopping, got 2
[10:59:13][D][esp-idf:000]: E (235825) AUDIO_ELEMENT: [decoder] Element already stopped

[10:59:19][E][esp_adf_pipeline:246]: Timeout while STOPPING. Stopping pipeline!
[10:59:19][D][esp_adf_pipeline:448]: [MediaPlayer] Pipeline changed from ABORTING to DESTROYING. (REQ: 4)
[10:59:19][I][adf_media_player:192]: got new pipeline state: 11, while in MP state PLAYING
[10:59:19][I][adf_media_player:256]: current mp state: PLAYING
[10:59:19][I][adf_media_player:257]: anouncement: false
[10:59:19][I][adf_media_player:258]: play_intent: false
[10:59:19][I][adf_media_player:259]: current_uri_: yes
[10:59:19][D][esp_adf_pipeline:518]: Called deinit_all
[10:59:21][D][esp-idf:000]: W (243843) AUDIO_ELEMENT: [http-0x3d800a30] Element task destroy timeout[2000]

[10:59:21][D][esp-idf:000]: I (243845) AUDIO_PIPELINE: audio_pipeline_unlinked

WARNING creative-d80 @ 192.168.107.145: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for creative-d80 @ 192.168.107.145
WARNING Disconnected from API
INFO Successfully connected to creative-d80 @ 192.168.107.145 in 0.005s
INFO Successful handshake with creative-d80 @ 192.168.107.145 in 0.056s

More logs with it connected directly to the PC.

[11:13:28]ESP-ROM:esp32s3-20210327
[11:13:28]Build:Mar 27 2021
[11:13:28]rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
[11:13:28]SPIWP:0xee
[11:13:28]mode:DIO, clock div:1
[11:13:28]load:0x3fce3808,len:0x43c
[11:13:28]load:0x403c9700,len:0xbec
[11:13:28]load:0x403cc700,len:0x2a3c
[11:13:28]entry 0x403c98d8
[11:14:12]E (51202) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[11:14:12]E (51202) task_wdt:  - loopTask (CPU 1)
[11:14:12]E (51202) task_wdt: Tasks currently running:
[11:14:12]E (51202) task_wdt: CPU 0: IDLE
[11:14:12]E (51202) task_wdt: CPU 1: IDLE
[11:14:12]E (51202) task_wdt: Aborting.
[11:14:12]
[11:14:13]abort() was called at PC 0x4203e738 on core 0
[11:14:13]
[11:14:13]
[11:14:13]Backtrace:0x40377afa:0x3fc961800x4037d301:0x3fc961a0 0x40383129:0x3fc961c0 0x4203e738:0x3fc96240 0x40378e35:0x3fc96260 0x420ca3cf:0x3fcf4e40 0x4203ef91:0x3fcf4e60 0x4037e880:0x3fcf4e80 
[11:14:13]
[11:14:13]
[11:14:13]
[11:14:13]
[11:14:13]ELF file SHA256: 0000000000000000
[11:14:13]
[11:14:13]Rebooting...
[11:14:13]�ESP-ROM:esp32s3-20210327
[11:14:13]Build:Mar 27 2021
[11:14:13]rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
[11:14:13]Saved PC:0x40377704
[11:14:13]SPIWP:0xee
[11:14:13]mode:DIO, clock div:1
[11:14:13]load:0x3fce3808,len:0x43c
[11:14:13]load:0x403c9700,len:0xbec
[11:14:13]load:0x403cc700,len:0x2a3c
[11:14:13]entry 0x403c98d8

Do.you use music assistant? I find using that is the only way to get some stuff to play. Its due to a setting the music assistant uses its in the speaker settings. Enforce lossy mp3 or something like that.

Yes, this is with me using music assistant with the lossy mp3 option.

Sorry then I can’t really help much more as I am no expert. You could ask on the esphome discord channel, they can normally help.

That helps! Thanks!