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
#Optical SPDIF Media Player Out
24 messages · Page 1 of 1 (latest)
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.
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
Lemme know if I can be of any help
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...
Assuming of course, only PCM signals could be supported (2.0 stereo).
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
Are you just holding the spdif cable over the basic led on the esp32 board?
Yep
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...
👍
Now that the Home Assistant Voice PE code has a very capable media player that can take an ESPHome speaker for output, I went ahead and made a real ESPHome PR for this: https://github.com/esphome/esphome/pull/8065
That nabu media player is pretty great
Aaaand I've wired it into my Voice PE: https://github.com/esphome/home-assistant-voice-pe/pull/294
Maybe worth a new show-off post for the PE mod
How nice it would be to have input too.
To pass though signal from a TV, and interrupt it only when there's announcement...
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
I pushed a change to consolidate this into the existing speaker component; there's now just a simple spdif_mode flag to enable it