HNHacker News
TopNewBestAskShowJobs

gavv42

161 karma · joined May 3, 2019

submissionscomments
gavv42··on Show HN: Roc – Real-Time streaming over the network
AFAIK zita-njbridge is quite similar to Roc, but it's JACK-specific and has no loss recovery.
gavv42··on Show HN: Roc – Real-Time streaming over the network
Right.

You can as well configure the FEC block size (it should be smaller than the target latency), the length of network packets, the length of internal audio frames in the pipeline, and the resampler window. And also the I/O latency, e.g.PulseAudio buffer size. So basically you can configure all (or almost all) parameters that can affect the resulting latency.

I'll document these parameters and their configuration a bit later. (Currently you can find all of them in the man-page in in the API, but there is no overview page that explains how exactly do they affect the total latency).

gavv42··on Show HN: Roc – Real-Time streaming over the network
So far I mostly tested Roc on several 2.4 Ghz Wi-Fi networks. You can usually expect 100-500 ms in this case (depending on the network). See "Typical configuration" in this article[1].

Most likely you will be able to achieve lower latencies on a better channel, but I did no serious testing for lower latencies yet. This is in my to-do list.

[1] https://gavv.github.io/articles/new-network-transport/

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
That small experiment in my post does not include a correct latency estimation. I just configured all three transports with the desired latency. Actually I'm thinking about writing a tool for such benchmarks that will measure the overall latency (PA + network + PA).
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Thanks :)
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Interesting, thanks for sharing.
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Great!

> How far are you with supporting multiple sampling rates

Roc currently supports arbitrary input/output rates but only a single network rate (44100). If the network rate differs from the input/output rate, Roc performs resampling.

We're now finishing the 0.1 release, and I was planning to add support for more network encodings, including more rates, in 0.2. Feel free to file an issue or mail us with a list of encoding/rates you need.

> and multiple receivers?

No support yet. If you use a multicast address, it would probably just work though.

Again, feel free to file an issue and describe what you would expect from such support. I'll be happy to implement it if someone needs it.

Another question is how Roc will interact with your sync part. How do you perform synchronization?

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
I agree, calling it low was not quite correct. See the thread above: https://news.ycombinator.com/item?id=19828567

I didn't perform serious testing on latencies below 100ms yet. I've added to my todo that we should investigate the minimum supported latency.

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
> 300ms is still noticably laggy when the audio is part of a video.

Agree.

> Some media players can delay their audio to account for playback delay in the audio device, if the audio stack supports that. Does Roc support that, or if not, is it on your roadmap?

We have an open issue for implementing correct latency reports in PA modules. When we'll fix it, players that support that feature should automatically start taking the latency into account.

Thanks for reminding me, I'll test this feature specifically.

https://github.com/roc-project/roc/issues/171

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Thanks.

> Few questions: how do you 'capture' PCM stream in case of ALSA? It is straight forward to create a PA sink and plug it into PA configuration, but I am wondering about pure ALSA.

Good question :) Roc does not implement any special capturing code for ALSA, it just reads from the given device (using SoX currently). The user is supposed to use something like snd-aloop.

It would be possible to create a custom ALSA plugin I guess, but we have no plans for that currently.

You're right about the transport vs product part. I would prefer to work on the transport. And an ALSA plugin would be a product on top of it so it should be a separate project ideally. Actually, the same is true for our PulseAudio modules. I hope later we will either submit them to upstream or separate into a standalone project.

> Disclaimer: I am an author of https://www.github.com/gimesketvirtadieni/slimstreamer

Interesting, didn't see it before.

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
I see your point.

Many audio streaming apps requires 1-2 seconds latency (especially on Wi-Fi), that's why I called the 100-300 ms range "low". 100ms is the minimum I've seriously tested on Wi-Fi so far. 300ms is, roughly, the maximum UI delay that feels acceptable (you press "play" and hear the sound).

I'll think about the wording..

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Thanks.

> Does it support h323?

No, and there were no plans yet. But we probably can add support if someone will need it.

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Thanks for info.

> is there a reason to duplicate the work ?

I don't know yet. When the time comes to implementation we'll look whether we can re-use either the code or ideas or maybe instead integrate Roc into GStreamer as a network transport (actually I was thinking about it already and there is an item in the roadmap for it).

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Currently, no. Windows port is in our roadmap but not a priority right now. However, if someone would want to maintain it, I'm ready to accept PRs and help with porting.
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Thanks.

> Opus would be great with ROC because in case of buffer over/under runs the codec provides features to mask dropouts based on previous content. This is critical when using Wi-Fi.

Are you talking about its PLC or FEC? I didn't test it yet and I'm interested if people are using both of them with music.

BTW it would be also interesting to combine our FECFRAME support with Opus.

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Not yet. This is in our roadmap however.
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Good to know. Yes, Opus will be is one of the highest priorities for us after we'll make the very first (0.1) release.
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
> Would this make any difference?

If you have no issues with 1) latency 2) packet losses and 3) clocks difference, that would be no difference, at least until Roc could offer some new encodings.

(If you're using PA, it handles the clocks difference for you. Its RTP transport sometimes worked strange for me, but its "native" tunnels handled it well.)

> Does it currently support online plug-unplug the way RTP works without restarting pulseaudio?

Roc sinks and sink inputs may be loaded and unloaded at any time without restarting PA. But there is no service discovery yet, which means that 1) when a remote sink input appears, sink is not automatically added 2) when a remote sink input disappears, sink is not automatically removed. (We will add this in upcoming releases). Currently the remote sink input can appear and disappear at any time and the local sink will just continue streaming packets to the specified address.

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Yeah, SRTP is in the list :) It's not the highest priority right now, but I'll get to that sooner or later (sooner if somebody will be asking for it).
gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
Thanks, I didn't know about this project and will definitely look at the implementation.

Their documentation says they use TCP, which usually means that it won't handle low latencies on Wi-Fi due to packet losses.

On the other hand, they have service discovery, remote control, and multi-room synchronization. All three features are planned but not yet supported in Roc. We'll add the first two in upcoming releases, but the multi-room support requires a serious research.

Their documentation also says the client can correct time deviations by playing faster or slower. We use resampling for that instead. I'm wondering how they can avoid glitches without using a resampler.

One more difference is that they use their own protocols (both for streaming and control) while Roc relies on standard RFCs.

gavv42··on Show HN: Working on a new network transport for PulseAudio and ALSA
A brief summary.

I'm working on Roc, a toolkit for real-time streaming over the network. Among other things, it provides command-line tools and PulseAudio modules that can be used for home audio. It can be used with PA, with bare ALSA, and with the macOS CoreAudio.

The main difference from other transports, including PulseAudio TCP and RTP streaming, is the better quality of service when the latency is low (100 to 300 ms) and the network in unreliable (Wi-Fi). The post explains why and provides some comparison, usage instructions, and future plans.

There is still a long way to go, and now we're looking for people thoughts and feedback. Do you find the project useful? How would you use it? What features would you like to see?