#Optical SPDIF Media Player Out

24 messages · Page 1 of 1 (latest)

hasty cipher
#

I've been loving Music Assistant and had been playing with I2S audio interfaces until a coworker suggested I use the fancy DAC with audio-input that was already with our audio equipment. So I made a media_player component (built on top of gnumpi/esphome_audio that allows me to stream from Music Assistant to Optical SPDIF.
https://github.com/gnumpi/esphome_audio/pull/59

obtuse igloo
#

Wonderful!!!
Do you think it would be possible to implement a SPDIF-in? My use case would be to loop the SPDIF signal from the TV through the ESP, allowing volume control (with a number) and interrupting/resuming it for TTS announcements from HA, or webradio when TV not in use (with a select)

#

(pretty much like a soundbar, using TV's own remote signal caught by an IR sensor, also turn speaker amp on when there's signal, and turn off when lost)

#

I could also imagine multiple SPDIF-ins on separate GPIOs to act like an input selector.

hasty cipher
#

Do you think it would be possible to implement a SPDIF-in?
I think it would work but I'm not sure. SPDIF uses BMC encoding to make a clockless signal so I'm not sure if you could use I2S input for it. Maybe though. Another possibility is the RMT peripheral which I think can be configured for various clockless bitstreams.

As for an input selector you could probably do that in a really simple way that just echoes the bits from one pin to another pin simply with pin interrupts.

#

I like the way you're thinking about this! I've been mulling over the switcher idea. I wish the pin mux would let me hook two pins together without going to the CPU at all but that's not possible

obtuse igloo
#

Lemme know if I can be of any help

obtuse igloo
#

I don't think it would be a problem to dumbly echo bits between multiple input pins to an output pin (using a select), and physically loop it back on the board to another one handling RMT or whatever is needed to recognize it as SPDIF (to be able to adjust volume). Could be two separate components.

#

With some simple mute-like silence overriding the output in the moment of switching the pins, on the RMT in, to avoid clicks...

obtuse igloo
#

Assuming of course, only PCM signals could be supported (2.0 stereo).

hasty cipher
#

That's all i've handled, but i think the bitstream is the same, but you encapsulate compressed audio for 5.1. Probably not impossible to decode on esp32

cyan abyss
#

Are you just holding the spdif cable over the basic led on the esp32 board?

obtuse igloo
#

Yep

vapid otter
#

the spdif is just using a normal led and a thick plastic optical cable, nothing special. for longer distances you can switch to regular SFP's 😄 https://www.youtube.com/watch?v=3qojgJGtTos ..or you can use toslink for data 😄 https://kittenlabs.de/ip-over-toslink/

Computer network operators depend on optical transmission everywhere as it is what glues together our interconnected world. But most of the industry is running the same kinds of signals down the optical transceivers.

As part of my need to "Trust, but verify" I wanted to check my assumptions on how the business end of modern optical modules work...

▶ Play video
KittenLabs

2 channels @ 44kHz/16bit = 1536kbit/s digital data...

cyan abyss
#

👍

hasty cipher
#

That nabu media player is pretty great

hasty cipher
#

Maybe worth a new show-off post for the PE mod

obtuse igloo
#

How nice it would be to have input too.

#

To pass though signal from a TV, and interrupt it only when there's announcement...

hasty cipher
#

Yes! I bet you could do a SPDIF decoder + mixer on the ESP32-S3! Alternately you could definitely do a hardware switch with transistors to entirely bypass the output from the ESP32-S3. I've been thinking about something like this for my living room too

gusty perch
#

I pushed a change to consolidate this into the existing speaker component; there's now just a simple spdif_mode flag to enable it