2008-09-17

MPD: Music Player Daemon

About:

Music Player Daemon (MPD) allows remote access for playing music (MP3, Ogg Vorbis, FLAC, AAC, Mod, and wave files) and managing playlists. MPD is designed for integrating a computer into a stereo system that provides control for music playback over a local network. It also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.

@ MPD homepage

Overview:

I wont explain what it is - everyone knows it's a media player - ops i just did it.
I'm here to show you how to install it. It can be a little bit confusing.

Installation/Configuration:

# apt-get install mpd sonata
Now, the hard tash. It's necessary to configure mpd before any use of it. To start, edit the file /etc/mpd.conf. I recomend to make a backup copy just in case.
# cp /etc/mpd.conf /etc/mpd.conf.backup
# nano /etc/mpd.conf

  1. REQUIRED PATHS & OPTIONAL PATHS
    In this step it's necessary to configure the respective directories where are locatedyour music files. In the field music_directory add your music's directorie (it's only to possible to add one) and in the rest cpy the exemple.
    ######################## REQUIRED PATHS ########################
    # You can put symlinks in here, if you like. Make sure that
    # the user that mpd runs as (see the 'user' config parameter)
    # can read the files in this directory.
    music_directory “/home/os.meus.documentos/music”
    playlist_directory “~/.mpd/playlists”
    db_file “~/.mpd/tag_cache”
    log_file “~/.mpd/mpd.log”
    error_file “~/.mpd/errors.log”
    pid_file “~/.mpd/pid”

    ################################################################
    #
    ######################## OPTIONAL PATHS ########################
    #
    # If specified, MPD will save its current state (playlist,
    # current song, playing/paused, etc.) at exit. This will be
    # used to restore the session the next time it is run.
    #
    state_file “~/.mpd/state”
    #
    ################################################################
  2. DAEMON OPTIONS
    Add you user(in my case it's qaz) in the field user. Uncomment the rest.
    ######################## DAEMON OPTIONS ########################
    #
    # If started as root, MPD will drop root privileges and run as
    # this user instead. Otherwise, MPD will run as the user it was
    # started by. If left unspecified, MPD will not drop root
    # privileges at all (not recommended).
    #
    user “qaz”
    #
    # The address and port to listen on.
    #
    bind_to_address “localhost”
    port “6600″

    #
    # Controls the amount of information that is logged. Can be
    # “default”, “secure”, or “verbose”.
    #
    log_level “default”
    #
    ################################################################
  3. AUDIO OUTPUTS & MIXER
    Uncomment the the text lines wich represent your audio output. Im my case it's alsa.
    ########################## AUDIO OUTPUT ########################
    #
    # MPD supports many audio output types, as well as playing
    # through multiple audio outputs at the same time. You can
    # specify one or more here. If you don't specify any, MPD will
    # automatically scan for a usable audio output.
    #
    # See
    # for examples of other audio outputs.
    #
    # An example of an ALSA output:
    #
    audio_output {
    type “alsa”
    name “My ALSA Device”

    # device “hw:0,0″ # optional
    # format “44100:16:2″ # optional
    }
    #
    # An example of an OSS output:
    #
    #audio_output {
    # type “oss”
    # name “My OSS Device”
    # device “/dev/dsp” # optional
    # format “44100:16:2″ # optional
    #}
    #
    # An example of a shout output (for streaming to Icecast):
    #
    #audio_output {
    # type “shout”
    # name “My Shout Stream”
    # host “localhost”
    # port “8000″
    # mount “/mpd.ogg”
    # password “hackme”
    # quality “5.0″
    # bitrate “128″
    # format “44100:16:1″
    # user “source” # optional
    # description “My Stream Description” # optional
    # genre “jazz” # optional
    # public “no” # optional
    #}
    #
    # Force all decoded audio to be converted to this format before
    # being passed to the audio outputs.
    #
    #audio_output_format “44100:16:2″
    #
    ################################################################
    #
    ############################# MIXER ############################
    #
    # MPD needs to know what mixer settings to change when you
    # adjust the volume. If you don’t specify one here, MPD will
    # pick one based on which ones it was compiled with support for.
    #
    # An example for controlling an ALSA mixer:
    #
    mixer_type “alsa”
    mixer_device “default”
    mixer_control “PCM”

    #
    # An example for controlling an OSS mixer:
    #
    #mixer_type “oss”
    #mixer_device “/dev/mixer”
    #mixer_control “PCM”
    #
    # If you want MPD to adjust the volume of audio sent to the
    # audio outputs, you can tell it to use the software mixer:
    #
    #mixer_type “software”
    #
    ################################################################
  4. OTHER OPTIONS
    Uncomment this two lines:
    ######################### OTHER OPTIONS ########################
    #
    # The metadata types MPD will recognize.
    #
    metadata_to_use “artist,album,title,track,name,genre,date,composer,performer,disc”
    #
    # Enable this if you wish to use your MPD created playlists in
    # other music players.
    #
    save_absolute_paths_in_playlists “no”
    #
    ################################################################
  5. Outher configurations
    Stay as they are. To avoid any doubts,here is my final result.

Now, add your user( mine is qaz) at mpd group (can't explain why this step).

# groupadd mpd
# gpasswd -a qaz mpd

Make sure the folder ~/.mpd doesn't need root privileges.

To create data base (this can take a while):
$ mpd --create-db
In this moment we have mpd completed instaled and configurated.
$ mpd

Frontend:

We still need a frontend. I choose Sonata.

Sonata is an elegant GTK+ music client for the Music Player Daemon (MPD).

@ Sonata Homepage

Sonata's Screenshot. Click in the image to see more pics.

Sonata also needs some configuration. But first let us open it:
$ sonata
Go to Preferences, in the tab MPD add you datasi. My case:

  • Name: qaz
  • Host: localhost
  • Port: 6600
  • Password: (em branco)
  • Music dir: /home/os.meus.documentos/music/

If necessary kill both process (killall) e start mpd & sonata again.

References:
» Techzone/Zwame
» ArchLinux Wiki
» MPD homepage

My files:
» http://dotfiles.org/~uterrorista/%2Fetc%2Fmpd.conf

FeedBack:
Have a question? Please submit a comment :P

3 comments:

Anonymous said...

我的站點介紹:情趣用品,情趣用品,情趣用品,情趣用品情趣用品,
情趣用品,
情趣用品,
情趣用品,
情趣用品,
情趣用品 來看看 賣克

這一家的中古車的性能很好
室內設計這是我找過最好的一家唷!

室內設計這家很好!

保健食品代工,素食膠囊,順傑

你需要買雨傘,這裡有一把優良的雨傘讓你的,制服不會被淋濕唷!制服

清境農場
SEO排名真好玩耶
哪有好的網站設計公司
室內設計也太多家了吧
香舖拜拜都要去買香耶
你的廣告是哪一家廣告設計公司處理的?

Anonymous said...

Great article.

Thanks.

酒店上班請找艾葳 said...

艾葳酒店經紀提供專業的酒店經紀,酒店上班,酒店打工、兼職、酒店相關知識等酒店相關產業服務,想加入這行業的水水們請找專業又有保障的艾葳酒店經紀公司!
艾葳酒店經紀是合法的公司、我們是不會跟水水簽任何的合約 ( 請放心 ),我們是不會強押水水辛苦工作的薪水,我們絕對不會對任何人公開水水的資料、工作環境高雅時尚,無業績壓力,無脫秀無喝酒壓力,高層次會員制客源,工作輕鬆。
一般的酒店經紀只會在水水們第一次上班和領薪水時出現而已,對水水們的上班安全一點保障都沒有!艾葳酒店經紀公司的水水們上班時全程媽咪作陪,不需擔心!只提供最優質的酒店上班環境、上班條件給水水們。