bag is used to buffer data.
We use it to backup stuff on DAT. You shouldn't. It's still beta :-) It could also be used to buffer audio data before playing...
Read INSTALL file for compilation and installation instructions.
History: Why did we took it from timidity package and did things to it ? Well, it was just a quick hack to make DAT drive work faster when backuping over network. So we added few switches in to make it work nicely and few other which sounded like neat ideas. It was just a quick hack to bag.c, no docs, no makefile, no anything.
And then, much later, we needed something to test CVS installation, so we took it, added some docs, added autoconf support while learning it, added RPM .spec file while learning it, and learning CVS features along the way.
So, here it is. We would appreciate all ideas, patches etc.
ObDisclaimer about usability, reliability and fitness for any purpose: WE DISCLAIM!!!
Example of usage:
(a) backup to DAT
> tar cfvp - / | bag -v -v -w 4096 -m0 -b10M -t9M -o /dev/nrmt0h
I'm using very verbose mode to get nice statistics output, 10Mb of buffer with threshold of 9Mb and 0 seconds wait. Output is on nrmt0h, which is DAT. My tar is really a network pipe in real-world, and network is slower than DAT, so bag prevents contant seeks on DAT.
(b) playing music
> l3dec -sto song.mp3 | bag -b1m -t512k | aplay -m
This one takes raw output of l3dec MP3 decoder, buffers it (1Mb buffer, 512Kb threshold), and plays it out (aplay -m is from ALSA sound project). Net effect is that if l3dec is temporary slowed down or stopped (like waiting for CD to spin-up, or big load average, or disk thrashing peak), audio will continue to play without pops and cracks.