server icon indicating copy to clipboard operation
server copied to clipboard

Added Local Audio Source Provider

Open Torrax opened this issue 4 months ago • 7 comments

Note this plugin runs a raw PCM streams and will require optimizations in the MA FFMPEG to bring the buffering time closer to 1s to start the audio.

Currently without the optimizations, there will be roughly a 10-second start time to play/pause the audio. With optimizations, I was able to get this down to ~1 second (Player side buffer).

Torrax avatar Aug 26 '25 15:08 Torrax

Please note Marcels comment on GitHub about streaming PCM. Consider the AI comments above. I have run the workflow so you can see the Lint issues to be fixed.

OzGav avatar Aug 27 '25 00:08 OzGav

Please slim down the PR to only a plugin source, providing a source of audio (as raw pcm) to players. Then we will work on improving the internal machinery to get better latency.

marcelveldt avatar Aug 30 '25 12:08 marcelveldt

@Torrax any update on this one ? As soon as the bare provider implementation is in, we can start tweaking the core to handle the latency issues you experienced.

marcelveldt avatar Sep 10 '25 18:09 marcelveldt

Marked as draft, awaiting the review comments to be addressed. Once these are resolved, please mark the PR ready for review again, thanks!

marcelveldt avatar Sep 10 '25 18:09 marcelveldt

This PR adds a new Local Audio Source provider plugin that enables capturing real-time audio from ALSA input devices and streaming it to Music Assistant players. The plugin acts as a virtual AUX input for Music Assistant, allowing external audio sources to be integrated into the ecosystem.

Tip; would like to recommend using this readme guide (which I contributed to) as a basis to write documentation for this feature:

  • https://github.com/quebulm/Raspberry-Pi-Vinyl-Streamer/blob/main/README.md

Specifically the introduction and the "How It Works (Architecture)" sections there which explain both use case and prerequisites.

FYI, I also contributed to these similar guides which can also be used as a reference though don't think those are as good. See:

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

and

  • https://github.com/aschober/vinyl-cast/blob/master/README.md

PS: @Torrax Slightly off-topic but suggest that you also consider adding this feature to this new Linux Voice Assistant project too:

  • https://github.com/OHF-Voice/linux-voice-assistant/issues/46

    • https://github.com/OHF-Voice/linux-voice-assistant

      • https://github.com/OHF-Voice/backlog-issues/issues/45

Hedda avatar Oct 15 '25 10:10 Hedda

@Hedda I havnt actually wrote any documentation yet. Documentation is usually the last thing you do on the project when they project is actually available to release. The write up I provided is purely for the users that know what they are doing already and are setting my fork up in their source files. At some point I will look at updating the documentation after release.

As for the additional features as mentioned before when you brought up pipe wire, this is becomming way out of scope for this project. Again all this project is meant to do is purely run input audio source from a connected local device to that PC and play it over Music Assistant. I will not be expanding this project out at all past this scope. No additional features, no other services im adding this to. Purely ALSA devices playing directly to Music Assistant.

Torrax avatar Oct 15 '25 15:10 Torrax

@Torrax the optimizations for PluginSource are now merged in dev so this should help your usecase. If you can cleanup the temporary hacks for enforcing wav in your code so the code is isolated to your plugin source provider only, we can give this another review and aim for merging soon

marcelveldt avatar Oct 26 '25 13:10 marcelveldt