#!/usr/bin/perl use warnings; use strict; use Audio::DSP; #alsamixer must be setup right, just turn everything up :-) my ($buf, $chan, $fmt, $rate) = (4096, 1, 16, 44100); #use the formats from soundcard.h, plain 16 for $fmt might not work with sblive #($buf, $chan, $fmt, $rate) = (4096, 1, 8, 8192); #crummy minimum sound my $dsp = new Audio::DSP( buffer => $buf, channels => $chan, format => $fmt, rate => $rate); my $seconds = 5; my $length = ($chan * $fmt * $rate * $seconds) / 8; $dsp->init() || die $dsp->errstr(); # Record 5 seconds of sound for (my $i = 0; $i < $length; $i += $buf) { $dsp->read() || die $dsp->errstr(); } print "Play Back\n"; # Play it back for (;;) { $dsp->write() || last; } $dsp->close();