Here's a start on how it's done
#!/usr/bin/perl
use Audio::DSP;
#alsamixer must be setup right, just turn everything up :-)
$|++;
($buf, $chan, $fmt, $rate) = (4096, 1, 16, 22050);
#($buf, $chan, $fmt, $rate) = (4096, 1, AFMT_U16_LE, 44100);
#use the formats from soundcard.h, plain 16 wont work with sblive
$dsp = new Audio::DSP(buffer => $buf,
channels => $chan,
format => $fmt,
rate => $rate);
$dsp->init() || die $dsp->errstr();
# this buffers print to file so that you need ~ 10 secs of audio or t
+he file is 0
# like when you hit control-c after a couple of seconds
# open(OUT, "| speexenc -n --rate 22050 - test.spx ");
##this works for small low Q ogg
open(OUT, "| oggenc -r -R 8000 -B 8 -C 1 -q 0 - | cat > zztest.ogg ")
+
or warn "No oggenc $!\n";
while ( $buffer = $dsp->dread(4096) ) {
syswrite( OUT, $buffer, length($buffer) );
}
$dsp->close();
# If you don't set the output of the dsp with arecord, or this
# module, the dsp will go to it's lowest setting
# speexenc --rate 8000 --le --8bit /dev/dsp - | cat > 1.spx
# it works but it sounds lousy.
# to convert to wave
# sox -r 44100 -u -w -c 1 out1.raw out1.wav
# arecord -f S16_LE -c1 -r 22050 -t wav -d 3600 -D hw:0,0
# | speexenc -n --rate 22.05 - - > /home/zentara/`date +%d%b%y%H
+%M%S`.spx
|