Gentoo Archives: gentoo-user

From: michael higgins <linux@×××××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] [OT] Shell redirection magic for audio capture?
Date: Wed, 28 Dec 2005 20:32:19
Message-Id: 20051228122754.6d60b055@lbg2.evolone.org
1 Hello all.
2
3 Being comparatively clueless, I've considered this particular problem for a long time. I finally came to what I believe is a solution, but a clunky one. Can any shell wizards make this work any better? Is there some other solution?
4
5 In other words, it works, but I'd like to put an example up somewhere as a good method to be able to capture sound in progress. It wasn't obvious to me, so I hope it might help the next one like me. So, any suggestions as to how this method can be improved?
6
7 The procedure:
8
9 $ mkfifo audio_cat
10 $ mkfifo to_null
11
12 $ cat to_null> /dev/null& \
13 (cat audio_cat|AudioCompress -C -s 15 -m | \
14 tee to_null| aplay -r 22050 -f S16_LE -c 2 -D plug:hw:0)&\
15 mplayer -bandwidth 96 -cache 64 -ao pcm:file=audio_cat -playlist "http://asx.abacast.com/kboo.asx?ref=js&embedded=false&timeout=false&uofc=false"
16
17 ... So, now I hear something coming up I want to capture:
18
19 $ cat to_null | sox -r 22050 -c 2 -w -s -t .raw - -r 44100 -c2 -w -s -t .wav test.wav
20
21 $ <ctl-c>
22
23 ... etc.
24
25 So, it seems to work pretty well. It's a little glitchy when everything is loading.
26
27 AO: [pcm] 22050Hz 2ch s16le (2 bps)
28 Building audio filter chain for 22050Hz/2ch/s16le -> 22050Hz/2ch/s16le...
29 Video: no video
30 Starting playback...
31 Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
32 underrun!!! (at least 648.999 ms long)
33 underrun!!! (at least 496.815 ms long)
34 underrun!!! (at least 623.697 ms long)
35 underrun!!! (at least 117.697 ms long)
36 underrun!!! (at least 523.569 ms long)
37 A:1392.5 (23:12.4) 85.0% 0%
38
39 But, then solid as a rock, I think.
40
41 . . .
42
43 So, I'm just looking for any comments or suggestions, I guess.
44
45 Have a good New Year, Getoo-ers!
46
47 --
48 |\ /| | | ~ ~
49 | \/ | |---| `|` ?
50 | |ichael | |iggins \^ /
51 michael.higgins[at]evolone[dot]org
52 --
53 gentoo-user@g.o mailing list