cplay is an awesome media player for the command line since its pretty straight forward with support for multiple formats. below ill show you how to add flac support in gentoo to cplay.

first off, here is a copy of the .cplayrc file taken from the gentoo cplay wiki:

PLAYERS = [
        FrameOffsetPlayer("ogg123 -q -v -k %d %s", "\.ogg$"),
        FrameOffsetPlayer("splay -f -k %d %s", "(^http://|\.mp[123]$)", 38.28),
        FrameOffsetPlayer("mpg123 -q -v -k %d %s", "(^http://|\.mp[123]$)", 38.28),
        FrameOffsetPlayer("mpg321 -q -v -k %d %s", "(^http://|\.mp[123]$)", 38.28),
        TimeOffsetPlayer("madplay -v --display-time=remaining -s %d %s", "\.mp[123]$"),
        NoOffsetPlayer("mikmod -q -p0 %s", "\.(mod|xm|fm|s3m|med|col|669|it|mtm)$"),
        NoOffsetPlayer("xmp -q %s", "\.(mod|xm|fm|s3m|med|col|669|it|mtm|stm)$"),
        NoOffsetPlayer("play %s", "\.(aiff|au|cdr|mp3|ogg|wav)$"),
        NoOffsetPlayer("speexdec %s", "\.spx$"),
        NoOffsetPlayer("mplayer -slave %s", "\.(m4p|m4a)$")
        ]

for flac support, first emerge flac with “ogg” use flag enabled then emerge ogg-vorbis tools with “flac” use flag.

once those are emerged, emerge cplay with “mp3” and “vorbis” use flag.

when that is done, edit the above .cplayrc files ogg123 line to (taken from the cplay-dev mailing list):

FrameOffsetPlayer("ogg123 -q -v -k %d %s", "\.(ogg|flac)$"),

all done