Music player with random song command

music player

I recently migrated from Windows, where I've been using Foobar2000 for a long time. I've been looking for a music player that replaces a feature I considered basic.

What I need is a player that has a play random song command (which can be sent from the command line). Note, that this is different from shuffle, which most players have. In shuffle, the order of the songs is mixed, and the playback is random. What I am looking for is something where playback is ordered, but when a certain command is issued a song is randomly picked and the playback jumps to it; playback then continues on in the normal sorted order.

The closest I found was gmusicbrowser, which has a random album command. This is close, but I'd prefer an actual random song.

I don't care about things like looking up lyrics or fancy library interfaces, just a simple playlist that can handle 30k+ songs. I'd prefer something with a gui, but I could do command line only if need be.

Edit:
To clarify what I consider a normal ordered playback. It should play back in order of band, then year, then album, then track (or something similar, this should probably be configurable somewhere anyway). The only time it should deviate from this, and jump to a random song, is when it receives the random song command.

Best Answer

As already stated in the comments, you can do this rather easily using mpd and mpc:

mpc listall | shuf -n 1 | mpc add; mpc play
  • mpc listall will list all known songs from the music database
  • shuf -n 1 (from coreutils) will print one random entry from that list
  • mpc add will add this random entry to the current playlist
  • mpc play will start playing (or do nothing if mpd is already playing)

Although mpd and mpc are console applications there are also some graphical user interfaces available.

Related Question