Media player with esp32 s3 N16R8 and max98357 with Resonate synchronized audio

Media player with esp32 s3 N16R8 and max98357 with Resonate synchronized audio

I feel the need to start a discussion about this media player setup I am trying to test without much luck, if anyone else is having a play with this setup and can offer some advice it would be great.

Background. I have been using these media players as stand alone players with great success for some time, I use them to modify old 1950’s radios along with some 1970 transistor radio’s.

I have 5 that I am playing with now trying to get the Resonate stuff running, with my current yaml I have the normal media player working 100% of the time. The resonate media player side just seems to reboot the esp32, there are no logs, just instant reboot, whether trying to play a group or trying to play as a single player.About every 10th time or so I try to play the resonate player it will work fine and play for a long time if left alone.

Here is the latest yaml

substitutions:

  name: media-player
  friendly_name: Media Player
  i2s_lrclk: GPIO11
  i2s_bclk: GPIO09
  spk: GPIO07
  ledpin: GPIO48   #14
  ota_password: "stuff"
  key_encryption: "stuff"
  wifi_ssid: !secret wifi_ssid_4
  wifi_password: !secret wifi_password_4
  wifi_ssid_2: !secret wifi_ssid_2
  wifi_password_2: !secret wifi_password_2
  red: 100%
  green: 0%
  blue: 0% 
  rgb: GRB
  chip: WS2812  #WS2812 / APA106

  task: false
  bufdur: 200ms
  bufsize: 1000000
  logger: DEBUG

wifi:
  networks:
  - ssid: ${wifi_ssid}
    password: ${wifi_password}
  - ssid: ${wifi_ssid_2}
    password: ${wifi_password_2}


esphome:
  name: ${name}
  friendly_name: ${friendly_name}

esp32:
  board: esp32-s3-devkitc-1
  cpu_frequency: 240MHz
  variant: esp32s3
  flash_size: 16MB
  framework:
    type: esp-idf
    version: 5.5.1
  
    sdkconfig_options:
      CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST: "y"
      CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY: "y"

      CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC: "y"
      CONFIG_MBEDTLS_SSL_PROTO_TLS1_3: "y"  # TLS1.3 support isn't enabled by default in IDF 5.1.5

###### Copy below  ########

# Enable logging
logger:
  level: ${logger}

# Enable Home Assistant API
api:
  encryption:
    key: ${key_encryption}

ota:
  - platform: esphome
    password: ${ota_password}

psram:
  mode: octal
  speed: 80MHz

external_components:
  - source:
      type: git
      url: https://github.com/esphome/esphome
      ref: 3ecdf16d7555a80baa712273a1ca5c5134e6cf04
    components: [audio, mdns, mixer, speaker, resampler, resonate]
    refresh: 0s

resonate:
  id: resonate_hub
  task_stack_in_psram: ${task}
  kalman_process_error: 0.01  # Filter tuning parameter for time synchronization

i2s_audio:
  - id: i2s_output
    i2s_lrclk_pin: 
      number: ${i2s_lrclk}
    i2s_bclk_pin:  
      number: ${i2s_bclk}

speaker:
  - platform: i2s_audio
    id: output_speaker
    i2s_dout_pin:   
      number: ${spk}
    dac_type: external    
    bits_per_sample: 16bit
    channel: mono
    buffer_duration: ${bufdur}
    timeout: never
    sample_rate: 48000
 
 # Virtual speakers to combine the announcement and media streams together into one output
  - platform: mixer
    id: mixing_speaker
    output_speaker: output_speaker
    num_channels: 1
    task_stack_in_psram: ${task}
    source_speakers:
      - id: announcement_mixing_input
        timeout: never
        buffer_duration: ${bufdur}
      - id: media_mixing_input
        timeout: never
        buffer_duration: ${bufdur}
      - id: resonate_mixing_input
        timeout: never
        buffer_duration: ${bufdur}

  # Vritual speakers to resample each pipelines' audio, if necessary, as the mixer speaker requires the same sample rate
  - platform: resampler
    id: announcement_resampling_speaker
    output_speaker: announcement_mixing_input
    task_stack_in_psram: ${task}
    sample_rate: 48000
    bits_per_sample: 16
  - platform: resampler
    id: media_resampling_speaker
    output_speaker: media_mixing_input
    task_stack_in_psram: ${task}
    sample_rate: 48000
    bits_per_sample: 16
  - platform: resampler
    id: resonate_resampling_speaker
    output_speaker: resonate_mixing_input
    task_stack_in_psram: ${task}
    sample_rate: 48000
    bits_per_sample: 16

media_player:
  - platform: speaker
    name: "player"
    id: media_out
   # volume_initial: 50%
    volume_min: 0.1
    volume_max: 1.0
    volume_increment: 0.1
    buffer_size: ${bufsize}
    announcement_pipeline:
      speaker: announcement_resampling_speaker
      format: FLAC     # FLAC is the least processor intensive codec
      num_channels: 2  # Stereo audio is unnecessary for announcements
      sample_rate: 48000
    media_pipeline:
      speaker: media_resampling_speaker
      format: FLAC    # FLAC is the least processor intensive codec
      num_channels: 2
      sample_rate: 48000
    on_announcement:
      - mixer_speaker.apply_ducking:
          id: media_mixing_input
          decibel_reduction: 20
          duration: 0.0s
      - mixer_speaker.apply_ducking:
          id: resonate_mixing_input
          decibel_reduction: 20
          duration: 0.0s

    on_play:              
        then:
        - light.turn_on:
            brightness: 100%
            red: ${red}
            green: ${green}
            blue: ${blue}
            id: led

    on_idle:              
        then:
        - light.turn_off:
            id: led            

    on_pause:              
        then:
        - light.turn_off:
            id: led  

  - platform: resonate
    id: resonate_media_player
    name: ${name} Resonate
    speaker: output_speaker
    task_stack_in_psram: ${task}

    on_play:               
        then:
        - light.turn_on:
            brightness: 100%
            red: ${red}
            green: ${green}
            blue: ${blue}
            id: led

    on_idle:              
        then:
        - light.turn_off:
            id: led            

switch:
  - platform: restart
    name: "${name} Reboot"
    id: reboot_media_player_lab_reboot

sensor:
  - platform: wifi_signal
    name: "${name} WiFi Signal Sensor"
    update_interval: 60s 

light:
  - platform: esp32_rmt_led_strip
    rgb_order: ${rgb}
    pin: ${ledpin}
    num_leds: 2
    chipset: ${chip}
    name: "${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: 150ms
          update_interval: 150ms
          min_brightness: 20%
          max_brightness: 100%
      - pulse:
          name: "Fast Pulse"
          transition_length: 150ms
          update_interval: 150ms
          min_brightness: 20%
          max_brightness: 100%

text_sensor:
  - platform: resonate
    type: title
    name: Track Title
  
  - platform: resonate
    type: artist
    name: Artist
  
  - platform: resonate
    type: album
    name: Album
  
  - platform: resonate
    type: year
    name: Year
  
  - platform: resonate
    type: track
    name: Track Number

I have tried changing a lot of setting for buffers etc but it makes little difference, I have also tried changing the sdkconfig_options with no luck.

So is anyone else trying this and could share some tips?

1 post – 1 participant

Read full topic

HI-FI News

via Home Assistant Community – Latest topics https://ift.tt/HeVxD3g

November 23, 2025 at 02:13PM