Quantcast
Channel: Squeezebox : Community : Forums - 3rd Party Software
Viewing all articles
Browse latest Browse all 2059

Idea/PoC: Using ROC to inject arbitrary audio data into the system

$
0
0
Since I'd like to listen to Twitch Music streams and use my Podcast app which both only support Chromecast, I needed a way to somehow hook up a chromecast to my squeezeboxes.

Currently, to play anything apart from local files, music streaming or webradio, the only real options are either to use the WaveInput plugin or run an icecast or similar.

The former works fine if your audio source is right next to the server that runs LMS but of course has issues with a central NAS Setup being far away from the Hifi rack.
The latter is also a rather mediocre solution due to latency etc.

There were some posts somewhere in the WaveInput plugin thread which suggested to use netcat to transfer audio to the central server.
https://roc-streaming.org/ is basically that but better with stuff such as checksums, resilience against network issues etc.
It is also free software under the MPL-2.0

Basically, it's exactly what's required to solve this issue without having to deal with a full pulseaudio network setup.
You'd just run the roc-recv on the LMS host and then have something like a rasperry pi as an edge node to pick up your audio signal, send it to the central server and then distribute it from there.

This will of course never allow for lip-synced audio, however, as long as the latency is acceptable (~3s max), it should be sufficient for stuff such as the mentioned music streams, podcasts or listening to your record player.


To test this out, I copy-pasted the WaveInput plugin, changed its name and edited its custom-convert.conf to look like this:

Code:

#
# rocin
#
rocin mp3 * *
        # R
        [roc-recv] --d mp3 --rate=44100 -s rtp+rs8m::10001 -r rs8m::10002 -o -

And indeed it was working surprisingly well with only latency being an issue.
Using the MP3 codec there causes some buffer in the audio path to add >10s of audio delay into the setup which is of course unacceptable.

Interestingly, choosing pcm as the output format instead will result in the desired latency of 2-3s with no additional changes.
That suggests that there's some fixed-size buffer somewhere which will just buffer as much as it can which will be a lot when using compressed audio.

There must be something I can tune to get this down to an acceptible level.


This thread serves a few purposes:

First, this should be understood as
Quote:

Look, this works! This is something that could be extended further to achieve feature parity with stuff such as Yamahas MusicCast

Please point me in the right direction to get this working properly since I have absolutely no idea how to develop plugins for the LMS

Secondly, I hope that someone has an idea how to adjust the latency when using mp3 as the codec.
There is a webradio buffer setting in the audio settings of each squeezebox, however it doesn't seem related to this issue


Thirdly, if this works out, it might also be possible to extend the Squeezebox Radio firmware so that its line-in could be used for the signal injection.

Viewing all articles
Browse latest Browse all 2059

Trending Articles