Showing posts with label MPD. Show all posts
Showing posts with label MPD. Show all posts

Tuesday, December 6, 2011

How to control MPD with your Android Phone

I hope you know how to set up your network. This post won't cover that topic and just goes straight to the settings of MPD.
I'm using Doid MPD Client to control MPD from my phone. I haven't tested any other MPD client yet but I guess they are similar to Doid MPD.

First of all bind your MPD to your internal IP or DNS by editing these lines in your mpd.conf: bind_to_address "<your IP or DNS>"
port "6600"

You can also add a password: password "<your password>@read,add,control,admin" The options behind @ can be mix and matched the way you need them. Even multiple lines of the password setting are possible for different passwords with different options.

Don't forget to restart MPD after doing changes in mpd.conf.

The Droid MPD client is available in the Android Market: https://market.android.com/details?id=com.soreha.droidmpdclient

Just install it, configure the IP, port and password you've set up in your mpd.conf in the settings of Droid MPD client and enjoy a neat remote control for your music.

Tuesday, July 26, 2011

MPC, xbindkeys and multimedia keys

I want to use my multimedia keys with MPD even without an always running client.
Here's one way to make it work independently of the used window manager.

Install MPC and xbindkeys:

emerge mpc xbindkeys


Start xbindkeys to find the right settings and press the key you want to bind:

xbindkeys -k


If you don't get any output at all, use the following switch:

xbindkeys -mk


The output should look like this, it's my toggle play/pause key:

"(Scheme function)"
m:0x10 + c:172
Mod2 + XF86AudioPlay


"(Scheme function)" might be "NoCommand" in your case.

Copy the output into ~/.xbindkeysrc and replace "(Scheme function)" or "NoCommand" with the command for mpc:

"mpc toggle"
m:0x10 + c:172
Mod2 + XF86AudioPlay


Do this for all the multimedia keys you want to use.

My .xbindkeysrc looks like this:

"mpc toggle"
m:0x10 + c:172
Mod2 + XF86AudioPlay

"mpc prev"
m:0x10 + c:173
Mod2 + XF86AudioPrev

"mpc next"
m:0x10 + c:171
Mod2 + XF86AudioNext

"mpc volume -2"
m:0x10 + c:121
Mod2 + XF86AudioMute

"mpc volume 0"
m:0x10 + c:122
Mod2 + XF86AudioLowerVolume

"mpc volume +2"
m:0x10 + c:123
Mod2 + XF86AudioRaiseVolume


And yes.. my mute and lower volume keys seem to be switched for any unknown reason. You have to check if it's this case for you too, otherwise fit the commands to your needs.

Check the man page of MPC for all possible parameters:

man mpc


Finally start xbindkeys and add it to your autostart:

xbindkeys &



There are still two small issues.
a) MPC can't toggle mute or restore the volume after mute.
b) Toggling play/pause is working but I don't get sound for any reason when it starts to play again. I have to skip to the next song to hear the music again.

Monday, July 11, 2011

mpdscribble 0.22

Mpdscribble 0.22 was released three days ago and the curl bug seems to be fixed.
I've added it to the install instruction.

Saturday, May 21, 2011

Scribble, Scrabble, Scrobble.. MPD and last.fm

I'm using mpdscribble for last.fm scrobbling from now on since scrobby isn't in portage anymore.

And again I had to create and copy some stuff because I want to run it as my normal user like I also do with MPD.

Here's the way how I've made it work:

Mpdscribble <=0.21 has a small bug and doesn't work with >=curl-7.21.0, so the curl useflag needs to be disabled in /etc/portage/package.use:

media-sound/mpdscribble -curl


OR

Unmask the most recent version v0.22 in /etc/portage/package.keywords:

~media-sound/mpdscribble-0.22


Install mpdscribble:

emerge mpdscribble


Create the needed directories in your user home:

mkdir -p ~/.config/mpdscribble


Copy the config file from /etc/mpdscribble.conf to ~/.config/mpdscribble. You need to be root for doing so because the config file is only readable as root.

sudo cp /etc/mpdscribble.conf /home/<your user>/.config/mpdscribble/


Edit the config file ~/.config/mpdscribble/mpdscribble.conf but take care to use full pathes:

pidfile = /home/<your user>/.config/mpdscribble/mpdscribble.pid
log = /home/<your user>/.config/mpdscribble/mpdscribble.log
verbose = 1

[last.fm]
url = http://post.audioscrobbler.com/
username = <your last.fm user>
password = <your last.fm password>
journal = /home/<your user>/.config/mpdscribble/lastfm.journal


Everything else is commented out.

Now you can start mpdscribble:

mpdscribble --conf ~/.config/mpdscribble/mpdscribble.conf

Thursday, February 3, 2011

MPD clients in new Android Market

There are some Android Apps for MPD in the new Android Market.

https://market.android.com/search?q=mpd

Saturday, November 6, 2010

MPD and last.fm scrobbling

Important: This HowTo is out of date since scrobby isn't in portage anymore. Use this guide for mpdscribble.



Some MPD frontends have the scrobbler built in already, but what can we do if we use a player which can't scrobble on its own?

I've started to use ncmpcpp today which can fetch several informations from last.fm but isn't able to scrobble. Not a big deal.. there are some nice tools which are able to do that job and one of them is scrobby.

Since I'm running MPD as my own user I have to start scrobby as my user too.

First of all the install:

emerge scrobby -avq


Then copying the config to your home:

mkdir -p ~/.config/scrobby
cp /etc/scrobby.conf ~/.config/scrobby/scrobby.conf


Now some edits in the config:

dedicated_user = "<your user>"
log_level = "info" (none/info/verbose)
log_file = "~/.config/scrobby/scrobby.log"
pid_file = "~/.config/scrobby/scrobby.pid"
cache_file = "~/.config/scrobby/scrobby.cache"

lastfm_user = "<lastfm user>"
lastfm_password = "<lastfm password>"

Everything else is commented out.

Finally start scrobby:

scrobby ~/.config/scrobby/scrobby.conf


I've put this command into my Openbox autostart.sh so I don't have to worry about it anymore.


Some Links:
home of ncmpcpp
home of scrobby
lastfm

Thursday, November 4, 2010

Run Pulseaudio and MPD as own user

Oh huh.. I've ran into some meany troubles when installing MPD. It just didn't want to talk to Pulseaudio if it runs as systemwide daemon.

Solutions: Start MPD as your user or the Pulseaudio daemon systemwide.
Problem: Every Howto for Pulseaudio told me how bad and very bad and very very bad it is to run it systemwide ~.~

Okey.. not a big deal. Let's just set up MPD with your own user..

First of all install MPD:

emerge mpd -avq

I'm using the following useflags for it:

aac alsa avahi bzip2 curl ffmpeg fifo flac id3 ipv6 jack lame lastfmradio libsamplerate mad mikmod network ogg pulseaudio tcpd unicode vorbis wavpack -ao -audiofile -cdio -cue -debug -doc -fluidsynth -libmms -modplug -mpg123 -musepack -oss -pipe -profile -sid -sndfile -sqlite -twolame -zip

Some of them might not be available on every system because I'm using the live version from mpd overlay. It's available in layman.

Now the /etc/mpd.conf needs to go to the right place:

mkdir -p ~/.config/mpd/
cp /etc/mpd.conf ~/.config/mpd/


And finally some edits in the config.. mine looks like this:

music_directory "/mnt/media/music/collection"
playlist_directory "/mnt/media/music/playlists"
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/mpd.log"
pid_file "/var/run/mpd/mpd.pid"
state_file "~/.config/mpd/state"
bind_to_address "localhost"
audio_output {
type "pulse"
name "MPD"
}
replaygain "album"
replaygain_preamp "0"
volume_normalization "yes"

Everything else is commented out.

So far so good.. mpd should be able to run now.

mpd ~/.config/mpd/mpd.conf


I've put this line into my autostart.sh of Openbox. It's using really less CPU while idling so I really don't mind. Some frontends are able to start and stop it too but I'm switching the frontends sometimes for tests and silly things.