Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Add an analog AUX input port and ADC to enable it acting as an music network streamer source? #7

Open
Hedda opened this issue Dec 22, 2024 · 6 comments

Comments

@Hedda
Copy link

Hedda commented Dec 22, 2024

@FutureProofHomes @that1guy @alextrical Would you please consider adding an analog AUX input port and ADC (Line level stereo audio input to I2S) to a future ESP32 and ESPHome-based hardware in your product series in order to enable that appliance acting as an analog-to-digital music network streamer source?

Regardless if built-into future Satellite1 hardware or created as a a brand new seperate stand-alone product running different ESPHome firmware, I believe that this concept would be a great value-add feature if could as an option also use these type of smart-speaker as simple music streamer appliance with analog AUX input to use as audio source provider for Music Assistant.

High-quality audio music streamers are becoming more common but most of them are relativly expensive and all of them are only work within their own walled-in ecosystem (usually only workibg within the same brand, and Sonos probably being the most well known brand).

The fact is that having this feature is a large piece that the community is missing, there are no other easy-to-use product for this ability as a simple Music provider solutions for Music Assistant to stream audio from analog AUX input sources. Especially not any complete hardware running ESPHome firmware.

Meaning there is a demand and should be a market for an easy way to achieve a remote AUX input into Music Assistant from an external analog audio source like a vinyl record player (LP turntable) or cassette player.

See directly related feature request for Music Assistant:

What I would like to see a such product achieve is a basic solution that is easy to install/maintain and use that allow any less-than-tech-savvy-person to stream music from a vinyl record player (LP turntable) or analogue casette-player to any speaker or group of speakers in our home. The vinyl record player (turntable) setup she has a pre-amp with phono (RCA) output ports for analog audio in stereo.

I would therefore prefer if we could buy some kind of networked (Wi-Fi) enabled appliance like a music streamer with stereo AUX input port that it will use for on-the-fly perform analog-to-digital conversion (ADC) + encoding for streaming to a Music Provider inside Music Assistant.

  • Architecture example: Analog audio source with preamp -> ADC network appliance -> onboard conversion, encosibg and formatting > digital music stream over the local network -> Music Assistant -> Any compatible speakers/reciever on the same network.

I have yet found a commercial product that does this outside the walled garden of closed ecosystems. That is, there are commercial products that support this but they will only stream to their own branded speakers within their own closed ecosystems (e.g. Sonos, and Yamaha).

Are there any solutions that can do this but stream to a Music Provider inside Music Assistant so it can forward to any Player Provider types?

UPDATE: To clearify, I would prefer to not build/maintain a DIY project myself for this, I would instead like to buy a complete appliance product that just works out-of-the-box and can be used by anyone without knowing how it actually works, like magic! ;)

I think that the hardware should preferably have a high-quality ADC (analog-to-digital converter) for Hi-Fi music streams if possible. Even though I'm not an audiophile myself I believe having the final product list such capability in its specifications would make it apeal to a wider audience that might not buy it otherwise.

Normally you would today have to buy and setup an expensive propriatory Hi-Fi music streamer system to achive this with all componets coming from the same brand/manufacturer, however there are also mid-range products like the ”WiiM Pro Plus” from Linkplay that have both analog and digital audio input ports, but practially all of them will only stream within their own ecosystem so you need to buy both music streamers and stream receivers from the same brand for all your speakers to make them compatible.

Alternativly I guess getting input via Bluetooth audio streaming could work in pinch but I am not aware of any such devices that are not troublesome and Bluetooth is not a very great way for permanent streaming which can be WAF approved (as it is my wifi that wants to stream her LP-records).

PS: I have previously used the ”Vinyl Cast” app on an Android phone/tablet (with analog input and ADC via a USB Audio Device) for casting to Chromecast Audio using Google Cast which was user-friendly but it was very buggy as ”Vinyl Cast” app the kept crashing + aesthetically the solution as a whole was not WAF approved + it kind of ruined the nostalgic retro vibe having to use the interface of Android phone/tablet each time, (nice with it though was that at least the initial release of the Vinyl Cast app included using Audio ACR to detect the song being played, but unfortunately this feature relied on a now discontinued third-party library/service so the feature was removed.)

Image

@Hedda
Copy link
Author

Hedda commented Dec 22, 2024

Again, even if possible to achieve this today with a creative DIY setup, that is nor easy nor simple to maintain, nor a complete all-in-one product that you can buy.

Music Assistant how-to page for this currently only have suggestions on something that you can DIY build yourself using various parts with custom software and DIY hardware running on a Raspberry Pi, what is not what I would like/request here.

https://music-assistant.io/faq/stream-to/#music-assistant

So while you could use Darkcast to capture and Icecast to build a solution that will digitize and stream audio from your analog audio equipment like a vinyl record player (turntable/phonograph/gramophone) as a web radio stream (URL) that you could add as a radio station in Music Assistant, for such a DIY project you need an advanced audio-capture and ADC (analogue-to-digital converter) setup and compexed configuration that provides audio-input and digitalization. See proof-of-concept examples:

https://github.com/gieljnssns/darkice-libaacplus-rpi-guide/blob/master/README.md

And

https://maker.pro/raspberry-pi/projects/how-to-build-an-internet-radio-station-with-raspberry-pi-darkice-and-icecast

Those suggested DIY solution is also messy as it needs a lot of parts when your record player does not have a built-in USB Audio Device with ADC but instead the turntable only has analog audio out (RCA stereo output with or without pre-amp).

Please try to think about the same kind of people that would rather buy a Home Assistent Green applance instead of installing Home Assistant on a Raspberry Pi, so no DIY solution that will need to be maintained differently and seperatly.

Then you add the WAF factor to that and try to see that not everyone want to have a DIY solution containing many parts with a mess of connected wires right next to their pretty turntable in the living room as the would ruin the aesthetics look and nostalgic + retro feeling that is one of the main purposes for using a retro turntable with LP records.

@alextrical
Copy link
Collaborator

alextrical commented Dec 22, 2024

Assuming ESPhome can be setup for an audio streaming source. I can think of 3 possible solutions we could work with.

  1. The XMOS chip on the Sat1 Hat has 16 audio channel's of which we are using 6 (if I'm counting correctly) if we can convert line level audio to PDM we could read it in that way. The problem is we are running short of pins. But we could possibly read stereo in with 1 or 2 pins.

  2. We could make a shim that adds a stereo line input to the I2S bus, that could then be used to read audio in, though this would require an additional chip for line level to I2S

(Alternatively if squeezelite works as an audio source, or ESPHome)
3. An external/separate device that contains a line level to I2S chip, and a ESP32. Theoretically this should be possible to be a rather simple circuit, and power over 5V usb

@Hedda
Copy link
Author

Hedda commented Dec 22, 2024

To get more pins I guess that other additional solutions would maybe be possible if ever some day add a another ESP32 as as ansecond ”coprocessor” to the Satellite1, as suggested in the feature request linked bellow:

While it would make for a more complex solution you would then also have the option to off-load some processes to that second ESP32 as well if acting as a dedicared Thread Border Router or Bluetooth Proxy does not take up all of its reaources (which I believe it would not do if using the more powerful ESP32-C6 as that second ESP32)

@Hedda
Copy link
Author

Hedda commented Dec 22, 2024

@formatBCE I assume that a solution for this also needs some kind of dedicated Analog-to-Digital (ADC) IC hardware chip that is purposely made for sound and communication via I2S or I2C protocols, so which existing chips on the market looks good for that and will those work fine with either ESPHome or XMOS firmware?

Also wondering if you guys think this concept should reuse the existing i2s microphone I²S Audio Microphone component for this purpose or if a new custom component for ESPHome would need to be created to specifically handle high-quality Line level stereo audio input to I2S for HiFi-quality music input from an analog source and digitalization of that?

PS: I have previously seen that @gnumpi been working on custom audio components for ESPHome that uses elements from the Espressif Audio Development Framework (ADF) and his repository does mention ADC but it is way over my head.

@alextrical
Copy link
Collaborator

Looking over the datasheets, the most likeley candidate chip to use may be a "PCM1808". That would allow Line level stereo to I2S.

@Hedda
Copy link
Author

Hedda commented Dec 30, 2024

Tip! Found this article that compares some popular I2S ADC for Line-In audio feed:

That article includes all these chips:

FYI, it by the way looks like the "Muse Luxe Speaker" from Raspiaudio also has a 3.5mm headphone jack for "AUX" line level ADC stereo input (with their specifications saying up to 24-bit and 96 kHz sampling frequency) but again not sure if their existing ESPHome code that could make use of it for this purpose?

From what found it is either using ES8388 or WM8978 as external audio codec for the AUX jack? Looks like it has both, one for mic and one for the AUX jack? Seems like those can be used for either ADC or DAC or both?

Interestingly they also specifically mention this feature and the fact that its firmware is hackable in their marketing material.

Image

Image

PS: Off-topic but sounds as if that "Muse Luxe Speaker" is using the MAX98357A I2S Class D Amplifier DAC for output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants