Sunday, February 14, 2010

Splitting FLAC files by cue sheet

This post consists of two things, "FLAC" and "cue sheets".

As for FLAC you can refer to this or this post. Ofcourse those are not a technical overview, they are just my opinion and impression and you can find more on the web.

As for CUE sheets and the need for them, sometimes you get a whole album as a single mp3 or FLAC file and you can't rewind to the start of the song you want. That's where CUE sheets come to the rescue. CUE sheets are a description of the file, every song has (title, singer, ...) and where it starts and ends.

So what i needed was to split the FLAC(or an mp3) file using the CUE sheet(if exists). Was it an easy task?! On Linux :) it was. Please find the bash script below which does this task given the folder path and the cue sheet file path.

echo "split flac by cue sheets"
echo "Cue sheet file path: "
read cuesheet
echo "FLAC file path: "
read srcfile

# split files by the cuesheet
cuebreakpoints "$cuesheet" | shnsplit -o flac "$srcfile"
# import the tags from the cue sheet to the generated files
cuetag "$cuesheet" split-track*.flac

for file in *.flac ; do
# Get file index from file name

# Get Song title from tags
title=$(metaflac --show-tag=TITLE "$file")

# Change file name
newfilename="$index - $title".flac
echo "Added : $newfilename"
mv $file "$newfilename"
I am thinking of posting some scripts that i make and find useful every now and them. Hope they help :)

Saturday, November 14, 2009

Play FLAC files on symbian 5th edition mobile phones

Referencing my old post about FLAC, and how i was fascinated by the great sound quality it offers. Also mentioning that i had the ability to play them in my old Nokia N70 using oggplay. Unfortunately, i have changed my mobile and oggplay is not supported !, so i have either ways to go, convert my existing FLAC files to mp3, or find another alternative to oggplay.

As for the first option

you can try this on Ubuntu,

flac -cd "infile.flac" | lame -h - "outfile.mp3"

But ofcourse, you must have both packages flac and lame installed, if not try this

sudo apt-get install flac
sudo apt-get install lame

as for the first command flac -cd

"d" to decode the FLAC file
"c" to write the output to stdout

and the second command lame -h ,

"h" defines the sound quality for the output file, and can be replaced by -q {0-9} where 0 is the best quality. and Afaik is not related to the bitrate !

"-" which refers to the other dash, talls lame to take the input from the stdin. This clarifies the need for the "|" piping.

And regarding the second option

Actually i tried to google for it a while ago but in vain, but while i was writing this post, i thought i might give it another try, and i found this post !! which mentions this open source project FolderPlay which enables you to browse your files and play them (*.FLAC included).

This not only eliminated the need to convert back to mp3 and sacrifice the sound quality, but also eliminated the need to generate a playlist for each album, as i had to do with Nokia Music Player and Symbian Oggplay.

Viva Open Source :)

Saturday, May 02, 2009

Programmer Personality Test !!

I stumbled upon this test for programmer personality through Ramy Mahrous and here you can find the test itself and this was the result for me :)

Your programmer personality type is:


You're a Planner.
You may be slow, but you'll usually find the best solution. If something's worth doing, it's worth doing right.

You like coding at a High level.
The world is made up of objects and components, you should create your programs in the same way.

You work best in a Team.
A good group is better than the sum of it's parts. The only thing better than a genius programmer is a cohesive group of genius programmers.

You are a liBeral programmer.
Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We're not writing on paper anymore so we can take up as much room as we need.

Saturday, November 15, 2008


I found out about FLAC a few days ago by pure chance.

What is FLAC?

FLAC is an acronym for "Free Lossless Audio Codec" which is a format for Audio files.

Why it rocks??

FLAC differs from other audio codec's in that it is lossless, so sound quality is great and nothing is lost. It is the same as if you are listening to the original audio source. Note that mp3 is lossy, some data is lost in the compression operation. I used to listen to mp3's in my car's cassette using my Nokia N70, FLAC files are a huge difference in sound quality.

By the way, Nokia Music Player does not play FLAC files, but oggplay does. It is a good music player that is faster to load, has more options, very customizable and is open source.


Huge file size, a single album which might take 70-100MB takes about 300-500MB, but sound quality deserves such increase.

Check those links to know more about it:

In short, FLAC is when you realize that mp3 is a serious degradation in sound quality :)

Thursday, January 18, 2007

Solaris Express for free??!!!

I was checking the JDC (Java Developers Conference) web site, when i found a link to Roman Strobl's blog (as he is one the speakers in the conference). In this post, i found a screenshot of Solaris Express on his laptop.

This is how the screen shot looks:

Solaris Express codenamed Nevada is a program that lets you preview work in progress code base fully functional and tested. This way you can try and test new features only weeks after they have been developed. Solaris Express can be download for free from here. I have found also that part of the code base for Solaris has been opened for review by open source community through OpenSolaris project.

Enjoy it :).

Saturday, January 13, 2007

Unexpectedly nerd !!

So it turned out that i am a little nerdier than i had expected.

I am nerdier than 75% of all people. Are you nerdier? Click here to find out!

So what is your nerd score??