PDL::Audio 1.1 review

Download
by rbytes.net on

PDL::Audio is a Perl module for some PDL functions intended for audio processing. SYNOPSIS use PDL; use PDL::Audio; Oh

License: Perl Artistic License
File size: 250K
Developer: Marc Lehmann
0 stars award from rbytes.net

PDL::Audio is a Perl module for some PDL functions intended for audio processing.

SYNOPSIS

use PDL;
use PDL::Audio;

Oh well. Not much "introductory documentation" has been written yet.

NOTATION

Brackets around parameters indicate that the respective parameter is optional and will be replaced with some default value when absent (or undef, which might be different in other packages).

The sampling frequency and duration are by default (see individual descriptions) given in cycles/sample (or samples in case of a duration). That means if you want to specify a duration of two seconds, you have to multiply by the sampling frequency in HZ, and if you want to specify a frequency of 440 Hz, you have to divide by the sampling frequency:

# Syntax: gen_oscil duration*, frequency/
$signal = gen_oscil 2*HZ, 440/HZ;
# with a sampling frequency of 44100 Hertz:
$signal = gen_oscil 2*44100, 440/44100;

To help you, the required unit is given as a type suffix in the parameter name. A "/" means that you have to divide by the sampling frequency (to convert from Hertz) and a suffix of "*" indicates that a multiplication is required.
Most parameters named "size", "duration" (or marked with "*") can be replaced by a piddle, which is then used to give length and from (mono/stereo).

HEADER ATTRIBUTES

The following header attributes are stored and evaluated by most functions. PDL::Audio provides mutator methods for all them (e.g.

print "samplerate is ", $pdl->rate;
$pdl->comment("set the comment to this string");
rate

The sampling rate in hz.
filetype

The filetype (wav, au etc..). Must be one of:

FILE_NEXT FILE_AIFC FILE_RIFF FILE_BICSF FILE_NIST FILE_INRS FILE_ESPS
FILE_SVX FILE_VOC FILE_SNDT FILE_RAW FILE_SMP FILE_SD2 FILE_AVR
FILE_IRCAM FILE_SD1 FILE_SPPACK FILE_MUS10 FILE_HCOM FILE_PSION
FILE_MAUD FILE_IEEE FILE_DESKMATE FILE_DESKMATE_2500 FILE_MATLAB
FILE_ADC FILE_SOUNDEDIT FILE_SOUNDEDIT_16 FILE_DVSM FILE_MIDI
FILE_ESIGNAL FILE_SOUNDFONT FILE_GRAVIS FILE_COMDISCO FILE_GOLDWAVE
FILE_SRFS FILE_MIDI_SAMPLE_DUMP FILE_DIAMONDWARE FILE_REALAUDIO
FILE_ADF FILE_SBSTUDIOII FILE_DELUSION FILE_FARANDOLE FILE_SAMPLE_DUMP
FILE_ULTRATRACKER FILE_YAMAHA_SY85 FILE_YAMAHA_TX16 FILE_DIGIPLAYER
FILE_COVOX FILE_SPL FILE_AVI FILE_OMF FILE_QUICKTIME FILE_ASF
FILE_YAMAHA_SY99 FILE_KURZWEIL_2000 FILE_AIFF FILE_AU
path

The filename (or file specification) used to load or save a file.
format

Specifies the type the underlying file format uses. The samples will always be in short or long signed format.

Must be one of

FORMAT_NO_SND FORMAT_16_LINEAR FORMAT_8_MULAW FORMAT_8_LINEAR
FORMAT_32_FLOAT FORMAT_32_LINEAR FORMAT_8_ALAW FORMAT_8_UNSIGNED
FORMAT_24_LINEAR FORMAT_64_DOUBLE FORMAT_16_LINEAR_LITTLE_ENDIAN
FORMAT_32_LINEAR_LITTLE_ENDIAN FORMAT_32_FLOAT_LITTLE_ENDIAN
FORMAT_64_DOUBLE_LITTLE_ENDIAN FORMAT_16_UNSIGNED
FORMAT_16_UNSIGNED_LITTLE_ENDIAN FORMAT_24_LINEAR_LITTLE_ENDIAN
FORMAT_32_VAX_FLOAT FORMAT_12_LINEAR FORMAT_12_LINEAR_LITTLE_ENDIAN
FORMAT_12_UNSIGNED FORMAT_12_UNSIGNED_LITTLE_ENDIAN COMPATIBLE_FORMAT

PDL::Audio conviniently defines the following aliases for the following constants, that are already correct for the host byteorder:

FORMAT_ULAW_BYTE FORMAT_ALAW_BYTE FORMAT_LINEAR_BYTE
FORMAT_LINEAR_SHORT FORMAT_LINEAR_USHORT FORMAT_LINEAR_LONG
FORMAT_LINEAR_FLOAT FORMAT_LINEAR_DOUBLE
comment

The file comment (if any). device

The device to output audio. One of:

DEV_DEFAULT DEV_READ_WRITE DEV_ADAT_IN DEV_AES_IN DEV_LINE_OUT
DEV_LINE_IN DEV_MICROPHONE DEV_SPEAKERS DEV_DIGITAL_IN DEV_DIGITAL_OUT
DEV_DAC_OUT DEV_ADAT_OUT DEV_AES_OUT DEV_DAC_FILTER DEV_MIXER
DEV_LINE1 DEV_LINE2 DEV_LINE3 DEV_AUX_INPUT DEV_CD_IN DEV_AUX_OUTPUT
DEV_SPDIF_IN DEV_SPDIF_OUT

Requirements:
Perl

PDL::Audio 1.1 search tags