NAME

Audio::ConvTools - API to convert audio files from/to mp3 ogg and wav

SYNOPSIS

use Audio::ConvTools;
use Audio::ConvTools qw/:DEFAULT :Tmp :Log/;

$status = ogg2mp3('file.ogg');
$status = ogg2wav('file.ogg');
$status = ogg2wav('in.ogg', 'out.wav');
$status = mp32ogg('file.mp3');
$status = mp32wav('file.mp3');
$status = mp32wav('in.mp3', 'out.wav');
$status = wav2ogg('file.wav');
$status = wav2ogg('in.wav', 'out.ogg');
$status = wav2mp3('file.wav');
$status = wav2mp3('in.wav', 'out.mp3');

Audio::ConvTools::logMsg('This is a log message');
Audio::ConvTools::errMsg('This is an error message');

$tmp = Audio::ConvTools::getTmpFile('.wav');
Audio::ConvTools::destroyTmpFile(\$tmp);

OBJECT INTERFACE

No object interface is defined

DESCRIPTION

Audio::ConvTools provides miscellaneous tools to convert audio files between Ogg Vorbis, MPEG III and Wav files. This is a function interface only.

By default, all the conversions functions are exported. You can also export temporary file usage tools with the :Tmp tag, and logging tools with the :Log tag.

Moreover, two scipts are provided with this package:

  • audiocdmaker To brun audio CD

  • audioconv To convert audio files

PROGRAMS USED

To do the conversions, this module uses the following linux programs:

  • oggdec, tested with version 1.0.1

  • mpg321, tested with version 0.2.10

  • oggenc, tested with version 1.0.2

  • lame, tested with version 3.96.1

FUNCTIONS

EXPORTED BY DEFAULT

ogg2mp3

This makes a conversion from ogg to mp3:

$status = ogg2mp3('file.ogg');

This takes the ogg file name as argument, and returns the status of the conversion.

It first converts the ogg file to wav using ogg2wav, and then converts the wav to ogg.

The input file has to end with '.ogg' (case insensitive). The generated file will have the same name, excepts that '.ogg' will be replaced by 'mp3'.

ogg2wav

This makes a conversion from ogg to wav:

$status = ogg2wav('file.ogg');
$status = ogg2wav('in.ogg', 'out.wav');

This takes the ogg file name as first argument, and returns the status of the conversion. If a second argument is provided, this is the name of the resulting wav file.

The input file has to end with '.ogg' (case insensitive). If the second argument is not provided, the generated file will have the same name, excepts that '.ogg' will be replaced by 'wav'.

mp32ogg

This makes a conversion from ogg to mp3:

$status = mp32ogg('file.mp3');

This takes the mp3 file name as argument, and returns the status of the conversion.

It first converts the mp3 file to wav using mp32wav, and then converts the wav to ogg.

The input file has to end with '.mp3' (case insensitive). The generated file will have the same name, excepts that '.mp3' will be replaced by 'ogg'.

mp32wav

This makes a conversion from mp3 to wav:

$status = mp32wav('file.mp3');
$status = mp32wav('in.mp3', 'out.wav');

This takes the mp3 file name as first argument, and returns the status of the conversion. If a second argument is provided, this is the name of the resulting wav file.

The input file has to end with '.mp3' (case insensitive). If the second argument is not provided, the generated file will have the same name, excepts that '.mp3' will be replaced by 'wav'.

wav2ogg

This makes a conversion from wav to ogg:

$status = wav2ogg('file.wav');
$status = wav2ogg('in.wav', 'out.ogg');

This takes the wav file name as first argument, and returns the status of the conversion. If a second argument is provided, this is the name of the resulting ogg file.

The input file has to end with '.wav' (case insensitive). If the second argument is not provided, the generated file will have the same name, excepts that '.wav' will be replaced by 'ogg'.

wav2mp3

This makes a conversion from wav to mp3:

$status = wav2mp3('file.wav');
$status = wav2mp3('in.wav', 'out.mp3');

This takes the wav file name as first argument, and returns the status of the conversion. If a second argument is provided, this is the name of the resulting mp3 file.

The input file has to end with '.wav' (case insensitive). If the second argument is not provided, the generated file will have the same name, excepts that '.wav' will be replaced by 'mp3'.

EXPORTED BY :Log

logMsg

This prints a contatenation of getNowStr, "INFO:" and the message to STDERR:

logMsg('This is a log message');

errMsg

This prints a contatenation of getNowStr, "ERROR:" and the message to STDERR:

logMsg('This is an error message');

EXPORTED BY :Tmp

getTmpFile

This returns a new File::Temp object with file name extension provided as argument:

my $tmp = getTmpFile('.wav');

destroyTmpFile

This destroys a temp file given, as reference, as argument:

destroyTmpFile(\$tmp)

The deferenced argument will be undef at the end of this function.

NEVER EXPORTED

getVersion

This returns the version of the module:

print "Module Version = " . getVersion();

This is used by binary script (the version of the scripts is the version of the module).

getNowTxt

This returns the actual date and time in format: Day YYYY-MM-DD hh:mm:ss:

print "We are " . getNowStr();

This is used by logMsg and errMsg.

SEE ALSO

File::Temp, String::ShellQuote

AUTHOR

Michael Hooreman <mhooreman at skynet.be>

BUGS

Please report any bugs or feature requests to bug-audioconv-tools at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Audio-ConvTools. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Audio::ConvTools

COPYRIGHT & LICENSE

Copyright 2006 Michael Hooreman, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.