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

constant buffering even with silence #12

Open natedreger opened 4 years ago

natedreger commented 4 years ago

This program is exactly what I need to get my whole house audio setup going. One catch I'm having is that even with silence the buffer keeps writing to my fifo file. Have tried setting the silence threshold to max and no different. This may not be an issue for others but I'm using forked-daapd to automatically play when a fifo starts and using cpiped and Shairport to feed it.

I've tried different sound cards and different paths in arecord, no help.

Hope someone can help!

natedreger commented 4 years ago

Nevermind, fixed it myself. Rearranged some things and added if (soundcount > 0).

maweki commented 4 years ago

Can you share the diff of the fix please

natedreger commented 4 years ago

Can you share the diff of the fix please

Yes, new to github and haven’t coded in 20 years but will share code once I figure that out. If you want to try it yourself I basically separated the tasks of reading and writing and put the writing tasks inside of an if>then statement controlled by the soundcount variable.

monte-monte commented 4 years ago

Dirty fix would be changing line 368 to:

if (!fillbuf && !silent) {

Also would be nice to mute printf, for this period of silence. I'm not sure if there is need to do anything else in terms of rearranging the code.