MPD - Music Player Daemon

Written by BinnyVA on April 14, 2008 – 11:48 pm -

MPD is not for everyone.

Before continuing into the article, a word of warning. MPD is not for everyone. If you are a casual desktop linux user with zero geek genes, stay away from this player. There are many other simpler players for you.

But then again, ‘casual desktop linux user’ - that sounds like a contradiction in terms. The very fact that you are reading this means that you are a geek.

Getting Started with MPD

Setting up MPD is not as simple as other music players.

Installation

To see MPD in action, first we have to install MPD - and a client. I installed the following…

  • MPD server
  • MPC - A command line MPD client
  • gmpc - A GUI client for Gnome

In a RedHat based system, you can install these using the command…

yum install mpd mpc gmpc

Configuration

Here is where it starts to get a bit confusing. MPD don’t have a pretty GUI to go along with it. It has to be configured using a text file. Create a file ‘.mpdconf’ in your home folder and enter the following in it…


port					"6600"
music_directory         "~/Songs"
playlist_directory      "~/.mpd/playlists"
db_file                 "~/.mpd/mpd.db"
log_file                "~/.mpd/mpd.log"
error_file              "~/.mpd/mpd.error"

The ‘music_directory’(”~/Songs” in our example) must point to the folder where you keep your music. If you have your music in multiple folders then I cannot help you. MPD was designed with just one music root directory in mind.

It is a good idea to create the playlist folder now - it will prevent errors later on. To do that run the command…

mkdir -p ~/.mpd/playlists

Next run these commands…

mpd --create-db
mpc update
mpc add /
mpc play

If all went well, you must be hearing sweet music now. Here is an explanation of the commands we used and their purpose…

mpd –create-db
This will start the daemon. The ‘–create-db’ argument will read the contents of the root music directory and add the Music files to a text database. You should see the list of files being added into the DB. This may take some time to complete - based on size of your music collection.
mpc update
The command used here is ‘mpc’ - not ‘mpd’. We are using a command line client now. This command scans the root music directory for updates.
mpc add /
This command will add all the files in the music directory to the current playlist. Please note that the ‘/’ here means root music directory - and not the global linux root.
mpc play
This will start playing the files in the current playlist.

GUI Clients

There are many GUI clients for MPD - the ones I would recommend are…

  • Gnome Music Player Client(gmpc)
  • Sonata

Once the mpd daemon is up and running, just open these clients and click on the connect button to control the daemon using these clients.


Tags: , , , , ,
Posted in Audio, Configuration | 1 Comment »

Sound Issue in Fedora 8

Written by BinnyVA on November 14, 2007 – 5:48 pm -

Music

Today I upgraded my system from Fedora 7 to Fedora 8. The installation process went very smoothly. But once the installation was done, I started the long process of configuring it. That’s when I ran into the sound issue in Fedora 8 - and based on the forum posts, so did many others.

Basically, you get this error at KDE startup…

Sound Error Informational Message:
Error while initializing the sound driver:
device: default can't be opened for playback (Permission denied)
The sound server will continue, using the null output device

You will not be able to play any sound - amarok will crash if you try to play anything. But if you run system-config-soundcard(or System -> Administration -> Soundcard Detection), you will be able to hear the test sound. That is because you are running it as root.

Solution 1 - Console-Kit Service

Did you turn of Console-Kit and avahi-daemon startup services using system-config-services? If so, go back and re-enable them.

  • Run system-config-services(or System -> Administration -> Services)
  • Find Console-Kit and enable it
  • Find avahi-daemon, enable it
  • Restart the system and see if that fixed the problem.

This worked for me - so I did not try any of the following solutions.

Solution 2 - alsa-plugin

If the first solution did not solve the problem, try removing the pulseaudio plugin for alsa by running this command.

yum remove alsa-plugins-pulseaudio

Solution 3 - Permissions

If neither of the above work, open /etc/security/console.perms.d/50-default-perms and add this line to the top…

<sound>=/dev/dsp* /dev/snd/*

And at the end, add this line…

<console> 0666 <sound> 0600 root

Related Links

Hopefully, your problems are solved by now. If not, here are some links to help you further…

More about Fedora 8 in the next post.


Posted in Audio, Configuration, Fedora, Troubleshooting | 15 Comments »

Five Amarok Tips and Tricks

Written by BinnyVA on October 10, 2007 – 11:43 pm -

Amarok

Rating

If the rating feature is turned on you can rate the songs from the player…

Settings -> Configure Amarok -> General -> Use Rating = On

Ratings in Amarok

Song Information Fetching

Amarok can automatically fetch information about the current song from the internet

Lyrics

Context -> Lyrics

This will fetch the lyrics of the current song from http://lyrc.com.ar and display it within amarok.

Lyrics in Amarok

Singer Details

Context -> Artist

Fetches the Wikipedia page for the singer of the current song.

Album Cover

Right Click Song -> Edit Track Information -> Summary
Right Click on the CD Cover Image -> Fetch from Amazon.com
Click on the ‘Next’ button until you find an Image you like and then click ‘Save’.

Plugins/Extensions/Scripts

If you want more from amarok, you can install some Amarok plugins(they are called ‘Scripts’ in amarok)

If you did not find the plugin you need, you can write your own plugin.

OSD for Current Song

It is possible see the title of the current song without opening amarok.

Settings -> Configure Global Shortcuts -> Show OSD = Ctrl+Shift+Q(for example)

Now whenever you press that shortcut, a small OSD will popup showing the name of the current song and the artist.

Browse the Amarok DB

Amarok stores all the information in a SQLite database(by default). This can be found at ‘~/.kde/share/apps/amarok/collection.db’. You can browse through it with a software capable of opening SQLite. You will find playlists, albums, fetched lyrics etc.

I have not found a practical use for this - yet. If you find any, let me know.

More Tips…


Posted in Applications, Audio, Configuration | 3 Comments »

Global HotKeys For XMMS using KHotKeys

Written by BinnyVA on September 17, 2007 – 10:47 pm -

Wouldn’t it be great if you could just press a keyboard combination from any app and your player pauses? Winamp(version 5 onwards) had this feature if you enabled a plugin called Global Hotkeys. You can’t do this in XMMS - but you can set up KHotkeys or Input Action to do it for you.

This is an extremal cool feature of KDE(sorry - no support for Gnome). You can access this feature by opening up Control Panel->Regional & Accessability->Input actions. You could configure it to give some commands to XMMS when you press a shortcut key.

The Examples group already have a XMMS action - next. Follow the format of that example to set the shortcuts for other actions in XMMS. I have 3 action in my system…

  • Play/Pause - Ctrl+Alt+Home
  • Previous Song - Ctrl+Alt+Page Up
  • Next Song - Ctrl+Alt+Page Down

XMMS in KHotkeys

Working of KHotkeys

For this example, I am going to create the Next Song action for XMMS. Click on the New Action Button at the bottom.

First you have to set the action type - the simplest is ‘Keyboard Shortcut->Keyboard Input’. This type simulates a specified key input in a given application when you press the shortcut trigger. For example, when you press ‘Ctrl+Alt+Page Down’ KHotkeys will send the key ‘b’ to XMMS - that is the shortcut in XMMS to go to the next song.

Action Type

In the next tab, you can set up a shortcut trigger(Say Ctrl+Alt+Page Down).

Action Shortcut

The ‘Keyboard Input Settings’ tab does all the major work - it decides the key to be send and the application to which the key must be send. In our example, the Keyboard Input is ‘b’(XMMS Shortcut for the next Song).

Input Settings

Next click on New->Simple Window in the Window section. Now open XMMS, click on the ‘Autodetect’, and then click on XMMS. This will populate the fields of the Window popup. We only need the ‘Window Class’ - change the drop down to the ‘Is’ option.

Action Window

Now click the Apply button.

That’s it - open up XMMS and play any song. If you press Ctrl+Alt+Page Down, XMMS will skip to the next song.

Try doing other things with KHotkeys - it is a powerful tool.


Posted in Applications, Audio, Configuration, KDE | 1 Comment »

Turn On NumLock at Startup in Linux

Written by BinnyVA on August 14, 2007 – 11:23 pm -

Keyboard

Numlock is something that should be always on. I don’t understand why it is often off at start up. If that is the case for your system, this page will help you to turn on the Numlock as system start up in Linux.

BIOS

There is an option in BIOS that lets you set the status of Numlock at start up. You will have to search around for this one - it is located in different places in different BIOS versions. Make sure that it is on.

KDE

If the BIOS trick did not solve the issue, KDE has a configuration option where this can be set. That’s why I love KDE - whatever you want, there is an option for that…

Control Panel -> Peripherals -> Keyboards

Control Panel Setting For Keyboard

numlockx

It you still have the problem, install the program called ‘numlockx‘. This will turn on the Numlock at start up.


Posted in Configuration, KDE | 5 Comments »

KDE Control Center Customizations

Written by BinnyVA on August 2, 2007 – 9:30 pm -

System Settings

I have very specific tastes about how my system should look. I prefer the lean and fast appearance. This is one of the main reasons why I like KDE so much - you can customize the system to perfection. Gnome does not have this much options.

To modify the looks and shortcuts for the system, take KDE Menu->Control Center. Go Wild!!

This is how I have set up my system…

Appearance & Themes

Launch Feedback

  • Busy Cursor = Passive Busy Cursor

Screen Saver

  • Start Automatically = Off

Style

  • Widget Style = MS Windows 9x
  • Enable Tooltips = Off
  • Effects

    • Enable GUI Effects = Off

Window Decorations

  • Window Decorations = KDE2
  • Draw Titlebar stipple effect = Off
  • Draw Gradients = Off
  • Buttons

    • Show window button tooltips = Off
    • Use custom button positions = On
    • Button Order = Menu, All Windows, Above others, Title, Minimize, Maximize, Close

Desktop

Behavior -> General

  • Show tooltip = Off

Multiple Desktops

  • I like 8 desktops

Panels

  • Arrangement -> Size = Normal (Bigger Main Panel)

Menus

  • Quick Browser Menu -> Maximum number of Entities = 25
  • Quick Start Menu Items -> Maximum number of Entities = 0 (Hides the ‘Recently used software’ at the top of the KDE Menu)

Appearance

  • Enable icon Mouseover effects = Off
  • Show Tooltips = Off

Taskbar

  • Show Windows from all desktops = Off
  • Sort alphabetically by application name = Off
  • Group Similar tasks = Never

Window Behavior

  • Titlebar Actions

    • Titlebar Double-Click = Maximize
  • Moving

    • Display contents in moving windows = Off
    • Animate minimize and restore = Off
  • Advanced

    • Active Desktop Borders -> Only When moving windows = On

Regional & Accessibility

Keyboard Shortcuts

  • Too many changes to list.

Sound & Multimedia

  • System Notifications -> Turn Off All ‘Sounds’

Posted in Configuration, KDE | No Comments »

Install Windows Web Fonts(MS Core Fonts) in Linux

Written by BinnyVA on July 14, 2007 – 11:23 pm -

Fonts

Most site uses fonts that are available on Windows - if you want to view sites as the designer of that site intended, you need these fonts. And since I am a Web Developer, and spend most of my time on various sites, I had to install it.

Its not as easy as installing other software - but its possible. This is how you do it in Fedora 7…

  • Download the MS Core Fonts Smart Package File and save it as msttcorefonts-2.0-1.spec
  • Install rpm-build and cabextract packages
    yum -y install rpm-build cabextract
  • Build the Core Fonts package…
    rpmbuild -ba msttcorefonts-2.0-1.spec
  • Install the package…
    rpm -Uvh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

More Details…


Posted in Configuration, Desktops, Fedora | 2 Comments »

Hide the Sidebar in Konqueror

Written by BinnyVA on July 7, 2007 – 11:12 pm -

Konqueror is one of my favorite Linux applications. But as a File manager, it has a slight problem - the sidebar. I have never used it. I cannot understand why it is turned on by default. It is easy to hide it by pressing F9 - but I want to turn it off permanently.

Konqueror Sidebar

  • First, open a folder using Konqueror.
  • Window->Hide Navigation Panel(F9)
  • Settings->Save View Profile(File Management)
  • Overwrite the existing File Management profile
  • Restart Konqueror - this time the sidebar will be hidden.

If you want to see the sidebar again, just press F9.


Posted in Applications, Configuration, Desktops, KDE | No Comments »

MP3 Support In Fedora 7

Written by BinnyVA on July 2, 2007 – 9:58 pm -

Music

Fedora does not include MP3 support out of the box. This is because MP3 is a proprietary format. Fortunately, enabling MP3 support in Fedora 7 is very easy.

First thing to do is enable the Livna repository for Yum.

Run these commands as root

wget http://rpm.livna.org/fedora/7/i386/livna-release-7-2.noarch.rpm
rpm -ivh livna-release-7-2.noarch.rpm

The next step is to install all the necessary libraries. This is what I did…

yum install  gstreamer-plugins-ugly gstreamer-plugins-bad xine-lib-extras-nonfree

Install MP3 Support in Fedora 7


Posted in Audio, Configuration, Fedora | 3 Comments »

Remove the Booting Delay in Linux Bootloader Grub

Written by BinnyVA on June 25, 2007 – 9:12 pm -

System

The default Linux bootloader, Grub, has a 5 second delay in booting. This is provided so that the user has the time for selecting another Kernel/OS. But most users(like me) use just one Kernel. For us this extra 5 second is wasted time.

My windows-supporting brother often makes fun of Linux for its slow boot time. Our ‘Windows Vs Linux’ debates usually go like this…

My Brother: “Linux takes too long to boot.”
Me : “Windows may be faster to boot - but there is nothing in it that makes it worthwhile to boot into.”
Brother: “Linux takes too long to boot.”
Me : “The features in Linux makes it worth the boot time.”
Brother: “Linux takes too long to boot.”
Me : “Whatever…”

Naturally this motivated me to find ways to speed up my booting. Disabling the Grub delay is one of these methods.

Its very easy to do too - if you are comfortable with the terminal.

  • Become root (su -)
  • Edit /boot/grub/menu.lst (pico /boot/grub/menu.lst)
  • Find the line ‘timeout=5′
  • Change that to ‘timeout=0′
  • Save the changes (Ctrl+O)
  • Exit (Ctrl+X)

Restart to see the difference.


Posted in Configuration | No Comments »