User avatar
th3cak3
Posts: 44
Joined: Fri Dec 27, 2013 3:35 pm

looking for a simple and lightweight music player for PI ZERO

Tue Jan 16, 2018 5:48 pm

Hi,

I have a Raspberry pi ZERO W that I would like to turn into a small music player. A simple device, no streaming, no web interface etc. just to play local files.

I need you to find a music player that is:
- Light (as much as possible)
- Without graphical interface
- Basic functions (read / stop / pause / shuffle / prev / next / volume ...) can be manipulated by command lines
- Able to read mp3, flac and ogg

So I could control it from a python script.

thank you

gkreidl
Posts: 6116
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: looking for a simple and lightweight music player for PI ZERO

Tue Jan 16, 2018 5:54 pm

You could use omxplayer.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

scotty101
Posts: 3735
Joined: Fri Jun 08, 2012 6:03 pm

Re: looking for a simple and lightweight music player for PI ZERO

Tue Jan 16, 2018 7:20 pm

MPD and MPC would be a good choice. There is a python binding to control it.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

achrn
Posts: 376
Joined: Wed Feb 13, 2013 1:22 pm

Re: looking for a simple and lightweight music player for PI ZERO

Tue Jan 16, 2018 7:29 pm

omxplayer wants to add 220 MB of disk space on a Raspbian lite - it's not my first thought, when looking for a lightweight sound player, to install more than 200MB of videoplayer.

When I was wanting similar (for a similar reason) I used mpg123. It adds 7MB to a Raspbian lite.

I didn't, however, compare processor load - mpg123 is not processor hungry, but maybe omxplayer beats it by using videocore?

Beware, however, that I found a zero didn't work too well when outputting i2s - I've seen it suggested that it doesn't have quite enough oomph to bring up the audio stack fast enough to get the data fed into the DAC to avoid a click / pop at start. Something to do with starting a clock and not having teh data ready for it immediately? Whatever teh cause, I found exactly the same sound hardware (actually an adafruit speaker bonnet with avariety of speakers / transducers) on the same version of Raspbian worked fine on a RPI3, but gave me a pop at the start of tracks on a zero.

tpylkko
Posts: 382
Joined: Tue Oct 14, 2014 5:21 pm

Re: looking for a simple and lightweight music player for PI ZERO

Tue Jan 16, 2018 8:29 pm

In addition to the things already mentioned, I believe that mopidy would also fit your requirements. It is a mpd-like headless music server written in python. It is highly extensible, can be controlled from commandline, from python (I wrote my own python RFID controller so that I could have my daughter play music by showing the player RFID cards, it was one of the most well documented thigns I have ever worked with), from ready made web interfaces, from anything. It is available in Debian and therefor in Raspbian. I have run it on RPi A+ with 256 MB RAM without issue. Plays any kind of audio file you can find, ogg/flac/mp3/ac3/alac (apple lossless codec) and what more.
https://www.mopidy.com/

Then there is also the Volumio project, which distributes their own custom mpd player and surrounding Operating system. I know that most users use it over a web interface on their LAN, headlessly, but am not sure how easy it is to control it with other means.
https://volumio.org/

W. H. Heydt
Posts: 11005
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: looking for a simple and lightweight music player for PI ZERO

Tue Jan 16, 2018 11:13 pm

I use mplayer. I *think* it fits your criteria.

scotty101
Posts: 3735
Joined: Fri Jun 08, 2012 6:03 pm

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 17, 2018 8:00 am

tpylkko wrote:
Tue Jan 16, 2018 8:29 pm
Then there is also the Volumio project, which distributes their own custom mpd player and surrounding Operating system. I know that most users use it over a web interface on their LAN, headlessly, but am not sure how easy it is to control it with other means.
https://volumio.org/
Volumio just uses MPD so the standard python binding for MPD will give you the ability to control it.
Have used this in a prototype of an internet radio and I used python to 'tune' in to different stations.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

sparkie777
Posts: 121
Joined: Tue Nov 27, 2012 4:37 am

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 17, 2018 8:07 am

just

Code: Select all

apt install cplay
and you enjoy the lightest music player ever:-)
your requirements are all satisfied.
the backend is freely configurable. ogg123(1), mpg123(1), mpg321(1), splay(1), madplay(1), mikmod(1), xmp(1), play(1), speexdec(1) and even mplayer are all supported.

User avatar
th3cak3
Posts: 44
Joined: Fri Dec 27, 2013 3:35 pm

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 17, 2018 9:52 am

mocp : I get this

Code: Select all

Running the server...
Trying JACK...
Trying ALSA...
Trying OSS...
FATAL_ERROR: No valid sound driver!
FATAL_ERROR: Server exited!

mpd : i get this

Code: Select all

config_file: unrecognized parameter in config file at line 1: ID3

omxplayer : i get this... again

Code: Select all

Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
Error: Unable to open font
so i've install the following package ttf-freefont then with the command line omxplayer ma_musique.mp3 -o alsa It works !
Problem, no way to change the volume while it plays. Plus, no sound if omxplayer is in the background.

cplay : it works, but how to change the volume on the command line?

sparkie777
Posts: 121
Joined: Tue Nov 27, 2012 4:37 am

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 17, 2018 1:10 pm

volume could be set
either with

'cplay' directly: press the 'h' key to get some 'help' => to control volume use the 1..9, +, - keys.

or with the help of

'amixer' utility (if you have the 'alsa-utils' package installed)
Last edited by sparkie777 on Wed Jan 17, 2018 5:45 pm, edited 1 time in total.

k-pi
Posts: 930
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 17, 2018 1:27 pm

Mp3blaster, moc, cmus, or even mpg123?

I often just use mpg123 & mc, (to select the music files), even if I have GUI music players. ;)

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 17, 2018 6:28 pm

May I suggest the free and open ogg123? It's very lightweight, and can be run easily against plain old ALSA with no extra layers, and best of all - it's built to use the free ogg vorbis format.

apt-get install vorbis-tools

Example run:

nice -n4 ogg123 -d alsa -o dev:"hw:0" --audio-buffer 10000 somelovelyvorbis.ogg

Adjust nice to the Pi zero, as well as buffers (see man page for all of them) for best play and no jitter.
I am the Umbrella man

tpylkko
Posts: 382
Joined: Tue Oct 14, 2014 5:21 pm

Re: looking for a simple and lightweight music player for PI ZERO

Wed Jan 24, 2018 9:39 pm

scotty101 wrote:
Wed Jan 17, 2018 8:00 am
Volumio just uses MPD so the standard python binding for MPD will give you the ability to control it.
Have used this in a prototype of an internet radio and I used python to 'tune' in to different stations.
I believe I read on their page that they claim that they use a tweaked version of mpd, that is somehow "better" or "more audiophile". But yes, essentially mpd anyway and no differece w.r.t controlling with Python

anotherknight
Posts: 3
Joined: Wed Jan 04, 2017 7:40 pm

Re: looking for a simple and lightweight music player for PI ZERO

Tue May 08, 2018 3:43 pm

Although this is a late reply, the program you are looking for is cmus. There is a slight learning curve, but cmus isn't resource hungry in any way.

User avatar
scruss
Posts: 2561
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: looking for a simple and lightweight music player for PI ZERO

Tue May 08, 2018 4:29 pm

Ronaldlees wrote:
Wed Jan 17, 2018 6:28 pm
May I suggest the free and open ogg123? It's very lightweight, and can be run easily against plain old ALSA with no extra layers, and best of all - it's built to use the free ogg vorbis format.
Fails badly on the OP's “able to read mp3” requirement, tho'.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “General discussion”