SPDIF Output on I2C Media Player

Hello i would like to achieve the following:

Use an ESP32-WROOM or ESP32-C3 as a media player (will be used over Home Assistant for streaming musinc)

Output of the ESP32 should be refirected to SPDIF ( I dont need optical toslink just RCA copper is enough in order to hook it up on my Pioneer amplifier)

This is my biggest struggle how can i output SPDIF compatible stream (PCM) to my amplifier.

On top of that since the amplifier has a 3.5 jack IR Input i would use the IR module of esphome where instead of hooking it up to an IR Led i will connect the 3.5 jack that will drive with IR commands my amplifier.

If this cannot be done with esphome can someone provide with code that i can compile myself ?

I had found this: amedes/esp_a2dp_sink_spdif: S/PDIF driver for ESP32 (github.com)

Bud dont know how i can use it through ESPHOME

1 Like

Use esp32 squeezelite, it supports spdif. https://forums.slimdevices.com/forum/user-forums/3rd-party-hardware/109412-announce-squeezelite-esp32-dedicated-thread

You can then set up LMS plus Squeezebox (Logitech Media Server) - Home Assistant, or use SlimProto (Squeezebox players) - Home Assistant

Hello i am aware of Squeezelite but it only supports WROVER ESP32 and not typical WROOM modules. But thank you :smiley:

Well get one of those then.

1 Like

I’m happily using Music Assistant + I2S Media Player with a UDA1334A DAC but I think it’d be way more awesome to use SPDIF optical to connect to my fancy discrete DAC so I’m starting to look into this too.

Looks like ESP8266Audio has support for SPDIF that looks pretty simple.

It’s just using (abusing?) the I2S peripheral to blast out SPDIF data. Looks like it’s pretty slim on external dependencies. Might not be too hard to make an external component out of it.

I added SPDIF support in a pull-request to gnumpi/esphome_audio. It’s working well for me!

There’s some major media player refactoring happening for the core ESPHome in GitHub - esphome/home-assistant-voice-pe: Home Assistant Voice PE but once that stabilizes a bit I’ll look at adding SPDIF support there. Right now all the baked-in media_player stuff in ESPHome is hardcoded to use I2S so it’s not so easy to hook up SPDIF without a medium-sized refactor.