Feature #396
closedNeed a music player app
100%
Description
- Directory/File name
- Artist's Name
- Album name
The top level list shows one of these three and the user selects and drills down to find the music of interest.
It requires a playlist to be configurable and can be saved and reloaded.
It should display the current album cover and title being played.
This all means it needs to be able to read ID3 tags from mp3's and have a directory for album covers.
If I can find a lightweight player (one that easily cross-compiles on PiBox) I may use that, otherwise we may have to write one.
Files
Updated by Hammel about 10 years ago
Subsonic is also an (very good) option since it provides an API we can use from a GTK+ app. However, it requires Java 5 or later. See RM #
Updated by Hammel almost 10 years ago
Ampache requires MySQL so that one won't be used.
Updated by Hammel almost 10 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
- TagLib - id3 library that could be integrated into "AudioFE"
- id3lib - same as TagLib
- mpg123 command line player - could just call it from AudioFE
- Could also integrate libmpg123 and libao into AudioFE
- JamVM / GNU Classpath - both are in Buildroot and might be able to play Subsonic
Updated by Hammel almost 10 years ago
- Target version changed from 1.0 - Atreides to 0.13.0
Updated by Hammel almost 10 years ago
- Severity changed from 03 - Medium to 02 - High
Updated by Hammel about 8 years ago
- Priority changed from Normal to Urgent
- Severity changed from 02 - High to 01 - Critical
Updated by Hammel over 6 years ago
Here is a way to extract id3 info from mp3s using exiftool:
exiftool file.mp3 | egrep "Artist|Album|Title"
The problem is that this is a perl script and the module it belongs to is not specifically defined by Buildroot, though it may be possible to get it as a custom module. Alternatives to this include id3v2 or eyeD3. id3v2 only requires the idv3lib and is C code but it's output is not line oriented, making it harder to parse (but not impossible). It seems the best fit though it doesn't appear id3lib is included in Buildroot, re: I'd have to build both as a combined third party package.
Note that I simply need a way to create a DB for music, like I do with videos (via VideoLib and VideoFE). The player can be omxplayer, which knows how to play mp3 files.
Updated by Hammel almost 6 years ago
- Use ffprobe (part of ffmpeg) to extract metadata as JSON:
ffprobe -show_format -show_streams -print_format json <file> | jq .format.tags > <file>.json
- Use ffmpeg to extract the cover art for an individual file:
ffmpeg -i <file> <file>.png
- Set the root directory for music
- Find directories that contain music files.
- Create a .musicdb in that directory.
- Run ffmpeg to gen cover art to .musicdb/coverart for each file as file.png
- Run ffprobe for each file and output to .musicdb/file.json
That's it. No Internet lookups required. We assume your music is already tagged.
Users can search for music by Album or Artist (based on contents of all metadata files).
Now audioFE just scans the root directory for .musicdb/coverart and displays the first image found for each. Selecting an image selects that directory and extracts track names. User can play all or select one. No playlists to start (feature to be added later). Cover art for each track is displayed while playing the music. ESC stops the music playing or exits. omxplayer plays the music files.
This may be easier than I thought. I can add the DB generation to VideoLib pretty easily. Finding directories with music in them might be harder, maybe.
Updated by Hammel almost 6 years ago
- Target version changed from 0.13.0 to 1.1.0 - Upgrades
Updated by Hammel almost 6 years ago
- File genid3db.sh genid3db.sh added
Attached is the Bash script used to generate a database and extract cover art. Turns out it's pretty freakin' easy.
Updated by Hammel almost 6 years ago
- File genid3db.sh genid3db.sh added
Oops. Minor update to the script.
Updated by Hammel almost 6 years ago
- % Done changed from 10 to 20
Created new repo under Pibox project on GitLab. Pushed current code base to it. Code can now parse the db files, provides a selection of Album or Artist and shows a carousel of album art for both. Left and Right keys allow moving through the carousel.
Next up is to implement selection handling. In Album db hitting Enter on an album will show the available tracks and provide the playback options. In Artist db hitting enter shows the album carousel but only for the selected artist.
Playback options:- Show tracks (possibly sorted by album track number, if available)
- Up/Down moves through track list.
- Selecting active track plays it.
- Tab changes to playback settings:
- Repeat
- Random
- Auto play (play rest of tracks in list)
- ESC returns to carousel mode.
Updated by Hammel over 5 years ago
- % Done changed from 20 to 70
App is written and works fine on a build host (my laptop). It presents a carousel of artists and albums and a list of tracks to play that can be selected using up/down keys and ENTER to play (TAB changes mode from PLAY to STOP). It's possible to start playing a track, then select and play another one (even from another album) without first stopping the one that's playing. But to stop the playing track you either exit the app or change to STOP mode and hit ENTER again. Kinda cool that this is all written in Cairo and Pango.
There is one bug: Need to reset track index when leaving track mode so that choosing another album will start at the first track entry.
The test on the build host used vlc to play audio. Support for changing audio levels up/down should be added since that can be done by sending keys using a FIFO.
Still need to test this on the RPi. I need to create a USB stick with music that the app can browse and play.
Updated by Hammel over 5 years ago
Preparing test on RPi, I constructed my music databases (two of them) on a USB stick and tested on my desktop (bigger than my laptop). It exposed some bugs in how I find the files. Those were fixed and the changes pushed.
On the RPi the app comes up but fails to start because it can't find the default album.png image. This is in data/album.png in the source tree and appears to be hard coded in the source - I thought I made that configurable with the -T option but must have missed something. Anyway, on the RPi that file can't be found because it's actually in /usr/share/musicfe.
Once I fix that I think the app will start properly. Then I can see if it plays music and, probably more importantly, how responsive it is.
Updated by Hammel over 5 years ago
- % Done changed from 70 to 80
Fixed that bug, plus a couple others I uncovered while testing on real hardware. All were pretty minor and easy to track down.
App works fine on hardware. It's a little sluggish on an RPi 2. Strange thing: I accidentally built for RPi1 (Pi Zero) and the binary worked fine for an RPi1, even with a different toolchain. Not much performance difference when compiled with the RPi2 toolchain. Both worked fine.
Haven't tested on RPi3 yet.
Still need to add new app to meta build. After I do that (and probably test on a RPi3, just for performance differences) then I'm done with this issue.
Updated by Hammel over 5 years ago
- % Done changed from 80 to 90
Metabuild is updated.
Last thing is to do is test on RPI3 to see if performance is better.
Updated by Hammel over 5 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
Performance is about the same. At least it's not notably better or worse. Good enough for now.
All changes pushed. Closing issue.