POE::Component::Enc::Flac - POE component to wrap FLAC encoder flac
use POE qw(Component::Enc::Flac); $encoder1 = POE::Component::Enc::Flac->new(); $encoder1->enc(input => "/tmp/track03.wav"); $encoder2 = POE::Component::Enc::Flac->new( parent => 'mainSession', priority => 10, compression => 'best', status => 'flacStatus', error => 'flacEerror', warning => 'flacWarning', done => 'flacDone', ); $encoder2->enc( input => "/tmp/track02.wav", output => "/tmp/02.flac", tracknumber => 'Track 2', comment => [ 'title=Birdhouse in your Soul', 'artist=They Might be Giants', 'date=1990', 'origin=CD', ] ); POE::Kernel->run();
POE is a multitasking framework for Perl. FLAC stands for Free Lossless Audio Codec and 'flac' is an encoder for this standard. This module wraps 'flac' into the POE framework, simplifying its use in, for example, a CD music ripper and encoder application. It provides an object oriented interface.
To use this module, you will need the POE framework (See http://poe.perl.org/) and you will need to install the flac tool (See http://flac.sourceforge.net/).
This POE component encodes wav audio files into FLAC format. It's merely a wrapper for the flac program.
The module provides an object oriented interface as follows.
Used to create an encoder instance. The following parameters are available. All of these are optional.
This is the delta priority for the encoder relative to the caller, default is 0. A positive value lowers the encoder's priority. See POE::Wheel:Run(3pm) and nice(1).
0
Names the session to which events are posted. By default this is main.
main
Sets the encoding compression level to the given value, between 0 (least) and 8 (most). You can also specify 'fast' and 'best' which are synonymous to 0 and 8 respectively. If unspecified, the default compression level is 5.
5
These parameters specify the events that are posted to the main session. By default the events are status, error, warning and done respectively.
status
error
warning
done
Encodes the given file, naming the result with a .flac extension. The only mandatory parameter is the name of the file to encode.
.flac
The input file to be encoded. This must be a .wav file.
The output file to encode to. This will be a .flac file. This parameter is optional, and if unspecied the output file name will be formed by replacing the extension of the input file name with .flac.
A true value for this parameter indicates that the original input file should be deleted after encoding.
Use this parameter to pass Vorbis comments to the encoder.
For the comment parameter, the encoder expects tag-value pairs separated with an equals sign ('tag=value'). Multiple pairs can be specified because this parameter is a list. Note that this parameter must always be passed as a list even if it has only one element. This parameter is optional.
'tag=value'
Events are passed to the session specified to the new() method to indicate progress, completion, warnings and errors. These events are described below, with their default names; alternative names may be specified when calling new().
new()
The first argument (ARG0) passed with these events is always the instance of the encoder as returned by new(). ARG1 and ARG2 are always the input and output file names respectively.
ARG0
Sent during encoding to indicate progress. ARG3 is the percentage of completion so far (integer number 0 to 100), and ARG4 is the current compression ratio (real number, three decimal places).
Sent when the encoder emits a warning. ARG3 is the warning message.
Sent in the event of an error from the encoder. ARG3 is the error code from the encoder and ARG4 is the error message if provided, otherwise ''.
This event is sent upon completion of encoding.
Vorbis Tools oggenc(1), POE::Component::Enc::Ogg, POE::Component::Enc::Mp3, POE::Component::CD::Detect, POE::Component::CD::Rip.
http://www.ambrosia.plus.com/perl/modules/POE-Component-Enc-Flac/
Steve James <steATcpanDOTorg>
$Date: 2004/04/25 22:01:19 $
$Revision: 1.1 $
Copyright (c) 2004 Steve James
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::Enc::Flac, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Enc::Flac
CPAN shell
perl -MCPAN -e shell install POE::Component::Enc::Flac
For more information on module installation, please visit the detailed CPAN module installation guide.