Audio::DSP 0.02 review
DownloadAudio::DSP is a Perl interface to *NIX digital audio device. SYNOPSIS use Audio::DSP; ($buf, $chan, $fmt, $rate) = (
|
|
Audio::DSP is a Perl interface to *NIX digital audio device.
SYNOPSIS
use Audio::DSP;
($buf, $chan, $fmt, $rate) = (4096, 1, 8, 8192);
$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();
# Record 5 seconds of sound
for (my $i = 0; $i < $length; $i += $buf) {
$dsp->read() || die $dsp->errstr();
}
# Play it back
for (;;) {
$dsp->write() || last;
}
$dsp->close();
Audio::DSP is built around the OSS (Open Sound System) API and allows perl to interface with a digital audio device. It provides, among other things, an initialization method which opens and handles ioctl messaging on the audio device file. Audio::DSP also provides some rudimentary methods for the storage and manipulation of audio data in memory.
In order to use Audio::DSP, you'll need to have the necessary OSS drivers/libraries installed. OSS is available for many popular Unices, and a GPLed version (with which this extension was initially developed and tested) is distributed with with the Linux kernel.
Requirements:
Perl
Audio::DSP 0.02 search tags