Audio-ConvTools
view release on metacpan or search on metacpan
bin/audiocdmaker view on Meta::CPAN
#!/usr/bin/perl
################################################################################
# Make audio CD from audio files (ogg, mp3 and wav) #
# #
# Copyright (C) 2006 Michael Hooreman <michael_AT_mijoweb_DOT_net> #
################################################################################
#$Id: audiocdmaker,v 1.4 2006-10-28 10:24:21 michael Exp $
=head1 NAME
audiocdmaker - Make audio CD from audio files
The resulting CD will have his track in the same order than the arguments.
=head1 SYNOPSIS
audiocdmaker [--help] --device device --speed speed file1 [file2 [...]]
--device: CD Burner device
--speed : Speed of burning
example:
audiocdmaker --device /dev/cdrom-hdc --speed 20 tr1.mp3 tr2.ogg tr3.wav
=head1 DESCRIPTION
C<audiocdmaker> Burns an audio CD from audio Ogg Vorbis, MPEG III and Wav
files.
=head2 PROGRAMS USED
To do the conversions, this program uses the following linux programs:
=over
=item *
mpg321, tested with version 0.2.10
=item *
oggdec, tested with version 1.0.1
=back
To prepare tracks and burn, this program uses:
=over
=item *
sox, tested with version 12.17.9
=item *
normalize, tested with version 0.7.6
=back
To burn, this program uses:
=over
=item *
cdrecord, tested with version 2.01.01
bin/audiocdmaker view on Meta::CPAN
my $files = shift;
logMsg("Normalizing tracks");
if (system("normalize -m $files")) {
errMsg("Cannot normalize files");
return 0;
}
return 1;
}
sub resample($)
#resample a wav file to 44100 Hz
{
my $file = shift;
my $tmp = getTmpFile('.wav');
my $tmpName = $tmp."";
logMsg("Resampling $file to 44100 Hz");
#we make a temp file who is a copy of the input,
#and then we remove the input
copyWav($file, $tmpName) or do {
errMsg("Cannot copy input wav");
return 0;
};
unlink($file) or do {
errMsg("Cannot remove old input file: $!");
return 0;
};
if (system("sox $tmpName -r 44100 -c 2 $file")) {
errMsg("Cannot resample $file");
return 0;
}
destroyTmpFile(\$tmp);
return 1;
}
sub makeSampledWav($)
{
my $in = shift;
my $out = getTmpFile('.wav');
my $toWav = $in->{toWav};
my $inFile = $in->{file};
my $outFile = $out.""; #this is a File::Tmp=>textual context=file name
logMsg("Making samled file from $inFile");
&$toWav($inFile, $outFile) or exit(1);
resample($outFile) or exit(1);
return $out;
}
showCopyrights();
parseCmdline();
analyseFilesExtensions();
exit(100) unless prepareAndBurn();
__END__
#$Log: audiocdmaker,v $
#Revision 1.4 2006-10-28 10:24:21 michael
#Updated my email address.
#Changed to version 0.08
#
#Revision 1.3 2006-08-18 12:50:12 mhoo
#module is now Audio::ConvTool
#switched to version 0.06
#
#Revision 1.2 2006/08/18 12:28:28 mhoo
#AudioConvTools becomes Audio::ConvTools
#switched to v0.4
#
#Revision 1.1.1.2 2006/08/18 11:46:28 mhoo
#Version 0.9 Ready for CPAN
#
( run in 2.636 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )