Showing posts with label mp3. Show all posts
Showing posts with label mp3. Show all posts

Friday, June 29, 2012

MP3 tagging with Perl


#!/usr/bin/perl

use strict;
use warnings;

use MP3::Tag;
use File::Basename;

my $Directory = ".";

while (<$Directory/*.mp3>) {
my ($FileName) = basename($_, '.mp3');

my $Mp3 = MP3::Tag->new($_);

$Mp3->title_set($FileName);
$Mp3->artist_set('Artist');
$Mp3->album_set('Album');
$Mp3->year_set('2012');

$Mp3->update_tags();

print "Filename: $_\n";
print "Artist: " . $Mp3->artist . "\n";
print "Title: " . $Mp3->title . "\n";
print "Album: " . $Mp3->album . "\n";
print "Year: " . $Mp3->year . "\n";
print "Genre: " . $Mp3->genre . "\n";

$Mp3->close();
}

__END__

Friday, August 5, 2011

Convert WAV files to MP3 in Ubuntu

#!/bin/bash
# name of this script: wav2mp3.sh
# wav to mp3

for i in *.wav; do
 if [ -e "$i" ]; then
   file=`basename "$i" .wav`
   lame -h -b 192 "$i" "$file.mp3"
 fi
done