#!/usr/bin/perl use Audio::DSP; #alsamixer must be setup right, just turn everything up :-) ($buf, $chan, $fmt, $rate) = (4096, 1, 16, 22050); # $fmt=8 will work, but it's better to use the formats in soundcard.h # some soundcards won't like 8-bit sound, or may need to be re-initialized $dsp = new Audio::DSP(buffer => $buf, channels => $chan, format => $fmt, rate => $rate); $dsp->init() || die $dsp->errstr(); open(OUT, ">out.raw") or warn $!; while ( $buffer = $dsp->dread(4096) ) { print OUT $buffer; } $dsp->close(); # to convert to wave # sox -r 8000 -u -b -c 1 out.raw out.wav