I2s device does not play locally stored mp3s

Good evening,
I was able to find a solution myself. I can now play any sound file :slight_smile: Three aspects were important, at least in my case:

  1. The use of capacitors
  2. Using a specific sound - encoding format
  3. Saving the MP3s in an unprotected HA directory

(1.) The use of capacitors

Based on to this topic I added a 0.1 and a 10 uF bypass capacitor (simply soldered between the power supply’s GND and VCC.

(2.) Using a specific sound - encoding format

As I mentioned above, I was already able to successfully play cached text-to-speech using the i2S speaker via picoTTS. So I thought I should pay attention to the openHAB picoTTS audio format specifications when converting the sound as these were working: Signed PCM coded WAV-File with 16 bit depth. Used audacity for it.

(3.) Saving the MP3s in an unprotected HA directory

Home Assistant only protects media files in the media directory when accessed via http by appending an ?authSig= part to the file name as described above. Save the WAV files in the following (unprotected) directory:

/homeassistant/www/[yourdirectoryname]/[yourwavfilename].wav

Accessible from outside via:

http://[HA-IP]:8123/local/[yourdirectoryname]/[yourwavfilename].wav

Below you’ll find the relevant espHOME yaml-code-part for a working MAX98357 module attached to a ESP32 board (firebeetle32 In my case):

i2s_audio:
  - id: i2s_in
    i2s_lrclk_pin: GPIO17  # LRC Pin of the Max98357 
    i2s_bclk_pin: GPIO14   # BCLK Pin of the Max98357 

media_player:
  - platform: i2s_audio
    name: "Sound"
    id: sound
    i2s_audio_id: i2s_in
    dac_type: external
    i2s_dout_pin: GPIO18   #  DIN Pin of the MAX98357A 

button:
  - platform: template
    name: "Sound Button"
    on_press:
      then:
        - media_player.play_media: "http://[HA-IP]:8123/local/[yourdirectoryname]/[yourwavfilename].wav"