Play MP3s from the command line on Mac OS X

For maybe a year on and off I’ve been using a command-line music player from Hieper software called Play.

play icon

It’s not always what you want, like if you want to browse your music and pick one song at a time to play, or if you want to build a custom playlist. But if you want to play all songs in a directory, or a bunch of songs with some word (e.g. band or album name) in the file name, it’s great because you can be playing the song in about 5 seconds, without starting up iTunes and doing a search within the GUI.

Here’s how I’m using it at the moment, to play all the songs I have by Foals:

cd ~/Music
find . -type f |grep -i foals|play -vr

First I change directory to my music directory, then use find with grep to find all files that have the word ‘foals’ in their filename; and then just pipe that list to play -vr. Pretty quick, pretty simple.

The command line options -vr are “v” to display the name of the song currently playing, and “r” to play the list in a random order.

Update!

I became bored with typing all that find and grep guff, so I thought I would take a few minutes and quickly write a shell script that does it for me, all I wanted to have to do is type play search1 search2 and it would go.

A couple of hours of feature creep later, it now lists and counts the songs before playing them, and you can put an -r argument before or after the search keywords for a randomly ordered playlist. Here’s the script source:

So now, with the script in my path and a symlink named path, if I want to hear, say, Day ‘N’ Nite by Kid Cudi, I can just type:
play cudi.*nite
It’s still pretty nerdy cause you have to do regex-style search expressions. If I want to hear every song with “bass” in the title in random order, I do:
play bass -r

Here’s an example of it in use playing some British India:
playing MP3s

Posted: April 27th, 2009
Categories: Mac OSX
Tags: , , ,
Comments: No Comments.

You need to login to post comments!