ESPHome as Audio input with PCM1808 ADC #3763
Replies: 6 comments 10 replies
-
What do envisage MA needs to do beyond accepting a sound card input which is already on the backlog as local audio in? Also I mentioned that native support for ESP32 based players is also on the backlog which may also satisfy this? |
Beta Was this translation helpful? Give feedback.
-
![]() Required hardware will be an: Initial board for testing WiFi Line level input, for streaming audio from a remote source, to Music assistant, and then to remote speakers |
Beta Was this translation helpful? Give feedback.
-
@alextrical Nice! Very exiting so perhaps I am going off on a tangent and it is way too off-topic discussing your hardware design here(?) but can I suggest that you also add stereo (left and right) RCA connector (also known as RCA phone connector) as well since that most common plug format on HiFi line-level analogue sources equipment like a Turntable, CD-Player, and Cassette Players: Yoiu probably already know this but I highly recommend adding in-line galvanic isolator or other electrical isolation for audio line-in audio inputs in the power signal path as that prevents ground loop noises (and may also increase sound quality), so the user do not need to use a galvanicly isolated power-supply as a workaround (as works by creating a new ground for the USB power). Personally I have in several casa bought cheap galvanic-isolator (also known as Ground Loop Noise Isolator) with in-line 3.5mm to 3.5mm jacks to use on input audio to cheaper speakers with USB power. Regardless, a tip would be to borrow some ideas from HiFiberry as could be a good to steal ideas from the best for this similar concept(?): HiFiberry has more than one ADC HATs/Shields as Analog-to-Digital-Converter for Raspberry Pi, so maybe convert their designs to ESP32? HiFiBerry's ANALOG INPUT products like "HiFiBerry DAC+ ADC PRO", "HiFiBerry DAC2 ADC PRO", or "HiFiBerry DAC+ ADC" have inputs. For reference, the HiFiBerry DAC+ ADC Pro uses PCM1863 as Audio ADC: And it combines that PCM1863 Audio ADC for analogue input with an PCM5122 DAC for audio output: See: and Their two most "basic" models with ADC support combine a well-know DAC for output with ADC analogue audio input, and both looks like this: HiFiBerry DAC2 ADC Pro can also use their DSP add-on via a DSP header (pin-header): There is even an DAC+ ADC Stage Development kit https://www.hifiberry.com/shop/0-development-kits/stage-devkit/ Anyway, if you wanted to productize this to turn this concept into a product you might want to consider making the hardware design even more flexible and versatile to cover different similar use cases, and as such I would recommend maybe also adding a TOSLINK port for "S/PDIF" (also known as SPDIF or just TOSLINK) for digital optical audio input on the same device as well, (follow-up tip if size is in question then be aware that are combo-port for mini-TOSLINK as a component that combine an analog 3.5mm jack with a TOSLINK/SPDIF optical port): Ideally I think it would be awesome if a there could was also an more high-end varitant of the final product would also have a pre-amp (preamplifier) component module that could be turned off or bypassed via a manual swicth on the board as well, as that way a casual-user could connect a analog vinyl record player (turntable/phonograph/gramophone) directly to it and get it to work out-of-the-box without connecting it via an external pre-amp, while a more concered user could turn off the onboard pre-amp and connect an external pre-amp if they choose. That is, note that some but not all vinyl record players (turntables/phonographs/gramophones) have a built-in preamplifier (also known as a "phono preamp", "phone stage", or "RIAA pre-amp"), and even if they do you still often have the option to disable the built-in preamplifier in favor of using an external preamp of higher quality or a other RIAA EQ curve for a different sound. So if your Hi-Fi audio source equipment does not have a built-in pre-amp for analog output then you either need to buy specifically a USB Audio Device with pre-amp (like one of ones mentioned above) or use a separate high-fidelity preamplifier (RIAA/phono preamp) to put inline between the audio source equipment and the Audio Capture Device, (this preamp stage amplify the very quiet electrical signal generated by the cartridge on your vinyl turntable, as otherwise you will not get a high-quality signal that has been amplified enough to allow good digitalization). Examples of known good external preamplifier hardware equipment is the PHONO PP400. Tip: If for DIY is that you can build your own pre-amp following build instructions from the "Calvin-phono", "PlatINA", or RP1 projects: |
Beta Was this translation helpful? Give feedback.
-
@OzGav what we would like to be achieved with this feature request idea is to have a combination solution with support in both Music Assistant server and ESPHome firmware to be able make/build (or buy) a small ESP32-based device that has audio line-level ADC (Analogue-to-Digital Converter) for audio input from a connected analogue audio HiFi equipment like a Turntable, CD-Player or Cassette-Player, and for software in ESPHome on that deice to stream that audio to Music Assistant which in turn will forward to any speaker group that Music Assistant supports. The goal is to replace Darkice/Icecast based solution running on Raspberry Pi as linked here with a simple stand-alone ESP32-based WiFi device: So I think what would be needed is new or enhanced/improved code in both Music Assistant server (i.e. a Music Provider) and ESPHome?
PS: This is partially related to this other discussion as such a ESP32 + ESPHome appliance plug-and-play solution would be more user-friendly : |
Beta Was this translation helpful? Give feedback.
-
If you will be using PCM1808 (instead of ES7243E) then think you first need to add PCM1808 driver to ESPHome's Audio ADC Core(?): "The audio_adc component allows your ESPHome devices to use audio ADC hardware components, allowing the capture/recording of audio via the microcontroller from a range of sources." That is, ESPHome does already have driver support for ES7243E for its ADC core, but it does not yet have a driver for the PCM1808 as ADC: For reference see pull requests for ES7243E as the two examples of existing Audio ADC drivers for ESPHome: FYI, you can also find some back-story on Audio ADC here in comments by @kbx81 PS: Perhaps a better suited ADC IC alternative could be TAC5112 which has both ADC and DAC,? Or its predecessor AIC3204 (TLV320AIC3204)? (Noticed that while the TAC5112 is so new that ESPHome does not have any drivers for it, at least there is a DAC driver in ESPHome for AIC3204). Check out this "TAC5112EVM-K" complete evaluation kit (dvelopment board) for the TAC5112 but that cost a lot more than the IC alone: https://www.ti.com/tool/TAC5112EVM-K Note by the way that there is an a standard "TAC5112" and a matching Automotive SKU "TAC5112-Q1" so no idea which would be better(?). PPS: Can PCM1808 by the way do lossless audio codec encoding (i.e. audio compression) and formatting or will that need to be done in software on ESPHome on the ESP32 MCU or alternativly do you also need an hardware audio codec IC that does audio compression and formatting before transmitting/streaming? ...if that is the case then guess you also need a driver in ESPHome for a suitible stereo audio codec as well, or? |
Beta Was this translation helpful? Give feedback.
-
This is super cool! Any chance that this bluetooth input from the ESP32 natively? I know you can buy a dongle but if the ESP has bluetooth built in seems like it would work well. The use case would be for if I want to play music from my phone or other people want to play music from their phone to the network. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am looking to help design a solution that will help work towards the request(s) #2343 for a Sterio line level audio input as a source to MusicAssistant, something that is embedded and doesnt rely on a RPi/Embedded linux device, while also allowing for a Remote 3.5mm AUX input jack
I will get a Schematic drafted up, with the intent to make a open source PCB that can connect some ESP32-S3 and PCM1808 modules togeather to enable a 3.5mm jack to recieve audio into an ESPHome based firmware.
I will investigate and try to develop the Driver to add support for the PCM1808 in ESPHome if required.
If this is something you would be willing to investigate, I will happily get the initial KiCad project setup, and repo made available on my Github. I can send you a hardware development board once ive tested and confirmed that the ESPHome side is functional
Beta Was this translation helpful? Give feedback.
All reactions