b-fitzpatrick / cpiped

Captures an audio stream and outputs to a pipe with buffering and silence detection
GNU General Public License v3.0
71 stars 13 forks source link

buffer issues #8

Open oksijun opened 5 years ago

oksijun commented 5 years ago

I got regular "Filling buffer" messages when reading from a usb audio device (Behringer UFO202 & RPI 3 model B), even with nothing reading from the named pipe.

FWIW, these seem to have disappeared since changing the sample rate from 44100 to 48000 in cpiped.c and recompiling (also setting matching minimum and maximum buffer limits).

orakelet commented 3 years ago

I'm getting "Overrun occured" and a few seconds of silence all the time, and now and then the sound makes a jump. Running on a Pi 2 with command: cpiped -d hw:1 /home/pi/Music/beo -b 4 I'm running forked-daapd to send the sound out on the local lan. Any tips?

b-fitzpatrick commented 3 years ago

The "Filling buffer" and "Overrun occurred" messages are normal. cpiped is useful because it handles some timing mismatch between the source and output audio. When the source is slightly faster than the output, overrun will occur when the buffer fills up, and the output jumps ahead. When the output is slightly faster than the source, the buffer will empty, and there will be a bit of silence as it fills back up. A larger buffer will reduce the frequency of occurrence, but the jump or silence will be greater.

orakelet commented 3 years ago

Thanks, I will try different values and see if it helps.

b-fitzpatrick commented 3 years ago

@orakelet How frequently is it happening? If it's overrunning every ~45 seconds with a 4 second buffer, perhaps your source is at 48000 Hz and your output is at 44100 Hz. If it's much longer than that between events, then it's probably just the timing.

mmaslen commented 11 months ago

I got regular "Filling buffer" messages when reading from a usb audio device (Behringer UFO202 & RPI 3 model B), even with nothing reading from the named pipe.

FWIW, these seem to have disappeared since changing the sample rate from 44100 to 48000 in cpiped.c and recompiling (also setting matching minimum and maximum buffer limits).

Keen to understabnd how you changed the sample rate to 44100 please?

oksijun commented 11 months ago

Here's what I did at the time, but I make no claims as to whether it's the correct way to do this. For some reason I can't upload the diff directly so it's a tarball. rate.patch.tar.gz