haileys / bark

live sync audio streaming for local networks
GNU Affero General Public License v3.0
663 stars 11 forks source link

Doesn't run on RPi3 #3

Open AstraLuma opened 11 months ago

AstraLuma commented 11 months ago

image

Not enough CPU, so it never catches up--ALSA also complains about buffer underruns, and bark stats consistently shows it 500ms off.

It might run if PulseAudio wasn't necessary? But I couldn't figure out how to run it without pulse.

AstraLuma commented 11 months ago

(An RPi4 does keep up, although it's consistently 0-10ms off.)

AstraLuma commented 11 months ago

This will also likely impact the Raspberry Pi Zero 2.

haileys commented 11 months ago

@AstraLuma Thanks for the feedback! I saw your other issue too, I noticed there that you ran cargo build without the --release flag. Does compiling with optimizations help?

AstraLuma commented 11 months ago

I did both, enabling default release optimizations didn't get it running fast enough.

I'm assuming there's non-default optimizations that might help? I haven't dug into Rust compile/link options and if there's a "maximum optimizing for your current CPU" available.

haileys commented 11 months ago

I might have to look into it then! Right now it resamples inside the audio data callback, which is the cause of the ALSA underruns. I'm working on a branch which introduces a second buffer to decouple the DSP from the realtime network and audio threads, so hopefully that will help here too. I'll keep you posted.

AstraLuma commented 11 months ago

Enabling all of https://nnethercote.github.io/perf-book/build-configuration.html (except PGO) isn't enough.

[profile.release]
codegen-units = 1
lto = true
panic = "abort"
RUSTFLAGS="-C target-cpu=native" cargo build --release
AstraLuma commented 11 months ago

For comparison, the RPi3 at least keeps a consistent ~500ms behind.

An RPi1's delay just grows without bound, extremely rapidly.

sixtyfive commented 3 months ago

How did you get it to work in the first place, @AstraLuma? I mean the Pulseaudio setup and Bark configuration part. If you have a few mins, would be great to get a few pointers there. So far I'm not managing to get a working PulseAudio sink against ALSA going :-/

AstraLuma commented 2 months ago

How did you get it to work in the first place, @AstraLuma? I mean the Pulseaudio setup and Bark configuration part. If you have a few mins, would be great to get a few pointers there. So far I'm not managing to get a working PulseAudio sink against ALSA going :-/

I think I just installed a desktop distro and let it handle it.