4 ms·
Another fun trick, by piping through dd you can add a buffer between processes. Example: the raspberry pi has pretty slow SD performance and the USB bus can ge
by jstsch 12y ago
Another fun trick, by piping through dd you can add a buffer between processes.
Example: the raspberry pi has pretty slow SD performance and the USB bus can get hogged. If you record audio and want to encode + write it to SD you can easily get buffer overruns. Easily solved by a 10sec buffer between arecord and flac in my case.
- morenoh149 12y agothat's insanely cool. I would have probably spent a lot of time implementing the buffer in software.
- netghost 12y agoSo what would that look like? Makes sense, but dd has a lot of options, and I haven't fiddled with it much.
- jstsch 12y agoRecording 48Khz, raw, piping through a five second buffer, encode to flac and dump on a USB stick: arecord -D hw:1,0 -v --fatal-errors --buffer-size=192000 -f dat -t raw | dd bs=480000 | flac --endian=little --channels=2 --bps=16 --sample-rate=48000 --sign=signed -o /mnt/usbstick/`date '+%s'`.flac - Gotta love Linux :)
- icebraining 12y agoThere's also buffer(1). I found it because it never occurred to me to use dd for that! Nice tip. http://linux.die.net/man/1/buffer http://linux.die.net/man/1/buffer