Converting FLAC to MP3 on Linux

FLAC is Free Lossless Audio Codec. A 35 megabyte WAV file converted to FLAC will occupy about 25 megabytes. This is a good decrease in size, considering the fact that no quality is lost. But some files aren’t all about quality and thus will be much better in mp3 or even ogg. Converting these is really simple. The key to the convertion is to decode flac files back to wav and than to convert them to whatever else is that you want.

Here is an example script to convert a bunch of flac files in the directory to mp3s.

for FILE in *.flac
do
 echo Converting $FILE
 # Decode FLAC back to WAV
 /usr/bin/flac -d "$FILE"
 # Save the filename without extension
 BASE=`basename "$FILE" .flac`
 # Convert resulting WAV to MP3 with variable bitrate preserving good quality
 /usr/bin/lame -h -V 2 "$BASE".wav "$BASE".mp3
done

/usr/bin/flac utility is a part of Fedora Linux distribution. /usr/bin/lame is a part of LAME project. RPMs for Fedora Linux are available from a number of repositories, such as FreshRPMs.

A whole bunch of Gmail invites

I have my own server for everything I need, mail included. So all the Gmail fuzz is passing me by. But for the sake of those who are constantly in search for the invites, I’ll post the link to this site. It is basically a place for those who have invites to share them, and for those who are looking for invites to find them. Currently, they have more than 1,500,000 invites available. Add yours or grab one if you need.

webby_m3u

Today I have found a really nice way to listen to my home mp3s at work. All I needed to do is share my music directory via web and generate an m3u playlist with URLs to files. m3u playlist than could be downloaded and fed to XMMS, where I could select songs to play. It is also nice to use random playback until I find something I am in the mood for and than switch to sequential mode.

Anyway, I wrote a small Perl script to generate an m3u playlist. It dives into some directory recursively and correctly escapes all the URLs. Check the few configuration variables in the beginning of the file.

webby_m3u.perl

Bash prompts

Normal user promptroot promptToday I once again did something really stupid while being logged in as root. I already had my root and normal user bash prompts colored differently, but it turns out that the difference was not obvious enough. So, I decided to recolor the prompts a little bit more vividly.

It took me few minutes to refresh my memory with Bash Prompt HOWTO. After that I came up with this snippet in .bashrc of the normal user (left screenshot):

# Cyan on blue time and Yellow on blue user@host dir
export PS1="\n\[\033[44;1;36m\][\$(date +%H:%M)]\[\033[44;1;33m\][\u@\h \W]\[\033[0m\]$ "
export PS2="\[\033[44;1;36m\][\$(date +%H:%M)]\[\033[44;1;33m\][\u@\h \W]\[\033[0m\]> "

Root’s prompt (right screenshot) was a bliss after that:

# Cyan on red time and yellow on red username@host dir
export PS1="\n\[\033[41;1;36m\][\$(date +%H:%M)]\[\033[41;1;33m\][\u@\h \W]\[\033[0m\]# "
export PS2="\[\033[41;1;36m\][\$(date +%H:%M)]\[\033[41;1;33m\][\u@\h \W]\[\033[0m\]> "