M5Stack Atom Echo as Media Player (NOT voice assistant)

I’m experimenting with various ways to make a noise with the M5Stack Atom Echo.

Using the pin assignments from the voice assistant instructions, changing type from esp-idf to arduino, I have it working – sort of. When playing a wave file from HA (local media) the result is full of static.

I’ve read notes, generally associated with the voice assistant, about it (not exactly sure what it is here) not supporting raw files, and that the voice assistant platform is incompatible with media player (but I’m not using it). But there do not seem to be a lot of people using this as a media player alone.

My real goal is just to make a noise in a standalone environment, RTTTL would be fine. The media player is an intermediate step. But now I’m baffled as I do not see anything that might impact quality of playback, especially static (I mean, it’s digital). I can play the same wave file on a nest mini (as media player from HA) and it’s perfect.

Any thoughts or advice?

Here are the relevant portions:

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

esp32:
  board: m5stack-atom
  framework:
   type: arduino

i2s_audio:
  i2s_lrclk_pin: GPIO33
  i2s_bclk_pin: GPIO19

speaker:
  - platform: i2s_audio
    id: echo_speaker
    i2s_dout_pin: GPIO22
    dac_type: external
    mode: mono

media_player:
  - platform: i2s_audio
    id: media_out
    name: ${name}
    dac_type: external
    i2s_dout_pin: GPIO22
    mode: mono

Light’s in there and works, I stripped out the button. Solid wifi connection, I’m just a few feet from the main access point (-38dBm).

Oh, if flashed with the current voice assistant setup the static is NOT present. So I do not think the hardware is broken.

Linwood

I may have figured it out. I think it’s a sample rate issue. I converted what I had (not sure what it was) to 24k and now I have no static.

So… never mind. Though if there’s some setting I should have used to play higher sample rates, let me know.

I think you may have achieved what I’m searching for (and haven’t been able to find!), namely to use an M5 Stack Echo as a speaker output from HA (I just want it to announce messages based on certain events). Would you mind posting your final complete solution - I’m a bit new to HA and really struggling with this.

Actually I can’t – I’m in the middle of moving, and almost all the HA stuff is packed and torn down. I think the code at the top was right, but I gave up because the speaker was so incredibly quiet I saw no point in using it.

Thanks for replying - appreciated. I have managed to get it to output some sound but - as you say - is way too quiet. Off to find another solution, probably with a stock ESP32. Good luck with the move! :+1: