#setup a shell thru IPC to carry out different # mixer control commands my $pidcon = open3(\*CON,0,0,'/bin/sh'); # ...... ..... snip ...... #set Line as input print CON "amixer sset Line Capture cap\n"; #### #!/usr/bin/perl use Audio::DSP; #alsamixer must be setup right, just turn everything up :-) ($buf, $chan, $fmt, $rate) = (4096, 1, 16 , 8000); $dsp = new Audio::DSP(buffer => $buf, channels => $chan, format => $fmt, rate => $rate); $seconds = 5; $length = ($chan * $fmt * $rate * $seconds) / 8; $dsp->init() || die $dsp->errstr(); open(OUT, ">out.raw") or warn $!; # Record x seconds of sound for (my $i = 0; $i < $length; $i += $buf) { $dsp->read() || die $dsp->errstr(); print OUT $dsp->data(); } $dsp->close();