music-assistant / companion

Music Assistant Companion App
https://music-assistant.io/companion-app/
Apache License 2.0
28 stars 4 forks source link

[REQUEST] AUX input and audio casting built-into Music Assistant Companion for desktop OS (Linux/Mac/Windows) so can stream music from it to a Music Provider in Music Assistant? #40

Open Hedda opened 4 days ago

Hedda commented 4 days ago

This is a feature request for AUX input + audio format conversion + audio casting from the Music Assistant Companion app:

Please consider adding embedded/native features and functions for enabling AUX input as well as allowing audio casting capability built-into the Music Assistant Companion software application running on desktop operating-systems so that it can capture the music tracks from an audio input-jack (USB Audio Device) on the computer and stream it over the local network to a "Music Provider" in Music Assistant which so that it in turn can then be streamed/forwarded to Music Assistant's player providers (including multi-room).

It would make it super easy for users to setup/configure music streaming between analog audio sources connected to AUX input on the same computer running Music Assistant Companion and Music Assistant if there were options to select local AUX inputs as a Music Provider.

If possible please also look into if could also add Audio ACR (Automatic Content Recognition) to detect using fingerprints of the raw audio stream and match the current song being played from AUX input and add the related metadata to enable rich metadata to be displays in Music Assistant when playback from AUX input. That way playback history of songs played could be saved in Music Assistant.

Thus the main purpose want this feature request is to make it very easy for anyone to achieve stable music streaming from an analog audio source like example a vinyl turntable (also known as a vinyl record player, LP player, turntable, gramophone, and phonograph) or cassette deck / cassette player by connecting its analog audio outport to an audio-input jack (USB Audio Device) that has an ADC (Analog-to-Digital Converter) on an Android app which runs an app that will perform conversion to an appropriate format for music streaming and stream that to an "Music Provider" in Music Assistant so that it in turn can forward that to a Player Provider (i.e. network-attached audio receiver and/or smart speaker).

So what is missing is a way for getting AUX audio + audio conversion + audio casting inside the Music Assistant Companion software.

This should allow/enable local AUX sources to be visible in MA and playback can be controlled via HA UI or via automations or scripts.

Solution would like to see

Abilities for AUX input, audio conversion/transcoding, and audio-only casting all built-into Music Assistant Companion for desktops.

Bonus would be if could also add Audio ACR (Automatic Content Recognition) to detect and match the current song being played from AUX input and add the related metadata to enable rich metadata to be displays in Music Assistant when playback from AUX input.

Optionally could also add Music Assistant integration for automatic configuration AUX-input from addon in Home Assistant apps too.

Architecture:

Analog audio -> AUX input via USB Audio Device -> Music Assistant Companion -> Music Assistant -> players (receivers/speakers)

User-guide steps if and when implemented:

  1. Acquire Hardware = Use either audio source equipment with embedded USB audio codec output or get an external stand-alone USB Audio Device. Note that if the source is a vinyl record player (turntable) then you need to have an inline phone preamplifier (phone preamp) on the output or input, so a preamp either need to be built-into the audio source equipment or the USB Audio Device adapter, else you need to add an inline phone preamplifier (phone preamp) in between.
  2. Configure Music Assistant integration addon and setup local AUX-input as Music Provider in the Music Assistant Companion app.
  3. Configure Player Provider (players = compatible network-attached recievers and smart speakers in Music Assistant).
  4. Select playback from Local AUX input and start playback.

Additional context

You can also achieve this a non-userfirendly way by configure a combination of Darkcast to capture + Icecast running on a Raspberry Pi:

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

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 via the "URL" Music Provider.

For such a project you need an audio-capture and ADC (analogue-to-digital converter) device that provides stereo audio-input and digitalization (recording + endocoding). For example, you can use either a USB Audio Device Interface adapter from Behringer or IK Multimedia, or a HiFiBerry board with ADC.

You can find a generic tutorial for Linux here, and for those that like step-by-step guides for Linux look here and here (the first of which also offers a pre-configured Linux appliance image for Raspberry Pi 3 / Raspberry Pi Zero 2 W).

https://github.com/quebulm/Raspberry-Pi-Vinyl-Streamer

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

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

Personally I would suggest that interested developers should look into testing AUX inputs from USB Audio Devices like these:

Alternatives if not using this software

Similar feature/function could previously be also achieved via an Android-phone/tablet using the no longer maintained open-source "Vinyl Cast" app for Android OS, which is/was an Android app that wirelessly streamed the audio output from an analog vinyl record player to Chromecast-enabled devices like Google Nest/Home speakers (using Google Cast) while also detecting the song/track being played and adding rich metadata on-the-fly, as well as storing the history for additional processing.:

https://github.com/aschober/vinyl-cast

https://experiments.withgoogle.com/vinyl-cast

https://vinylcast.schober.tech/

https://play.google.com/store/apps/details?id=tech.schober.vinylcast.playstore

https://youtu.be/HBDkxEvCcHQ

PS: There are several additional indirectly related feature ideas for vinyl records playback in readme file for the Vinyl Cast app:

https://github.com/aschober/vinyl-cast/blob/master/README.md#future-ideas

arctixdev commented 4 days ago

Hey @Hedda, thanks alot for your feature request! Yes, this would indeed be a very nice feature! Personally I am gonna be away from the project for the next year or so, meaning its not something I personally would have time to work on. But other contributors are more than welcome to work on this!

Hedda commented 3 days ago

By the way, interested devs should know there are several vinyl record players with USB output today, a.k.a. "USB turntable", ex:

PS Just be warned all built-in embedded USB audio codec output and external USB Audio Device adapters are not created equal.