Every other bugger is building amplifiers, so rather than clutter up other threads with my random whining I figured I’d put it in its own thread. Feel free to mute.
I’m currently not working, and occasionally bored, so I figured I’d have a play with Android development. My background is all in server-side Java programming. So, Java - check, Android - not so much.
I installed the free “Android Studio”. This was the first serious hurdle. I’ve used the Eclipse development environment for the last 15 years. Android Studio is based on its mortal enemy, IntelliJ. Ho hum, there are a few conceptual differences, and a lot of basic key bindings to relearn.
Android already comes pre-loaded with a heck of a lot of support for storing and indexing media, and decoding and playing music. If I was going for the full monty reading music and playing it from scratch I’d be here forever. So this job is most likely to be concentrating on the user interface.
After poking around API documents and Stack Overflow for a couple of hours I discovered that the Android Open Source project already had a freebie music player app on GitHub. It’s a lot easier to learn by modifying someone else’s code than to start from scratch, particularly on a very unfamiliar platform, so this suits me down to the ground.
The basic idea is to mash this app around to do what I want. Eventually there will probably be nothing left of the original.
My basic requirements are:
- I want it to play FLAC files that are local to the device.
- I want it to handle the “album artist” tag gracefully, and not just use the “artist” tag.
- I want album art to work properly, just like it doesn’t in Google Play Music. Particularly I want to be able to display a folder.jpg that is in the same folder as the source file.
- I want it to work with USB DACs like the Chord Mojo - most apps in the app store are very cagey about this. Except one which appears to be the default and only option.
- Later on I want it to be able to display geeky shit like sampling frequencies etc.
I cloned the project from GitHub, fired it up, and it has a few tunes in, and it plays them. Superb! They are indexed by genre only. Where the hell is it finding these tunes? I can’t find any embedded mp3 files etc. It turns out that its terribly clever, and has the concept of music being provided from different sources, not just local files. The sole implementation retrieves some JSON from a server somewhere (looks like the Android Auto API server) which in turn references a few mp3 files on YouTube. It basically passes the URIs of these files to the music playing subsystem, which does the rest.
So the first challenge is to get files from the local storage.
I plonked a few files in the storage of an emulated Nexus 5, using the Android Device Monitor.
Android does a good job of indexing all these files for you, and you query the media store in a similar manner to querying a relational db - you get cursors and projections and columns and all that good stuff.
I won’t bore you with the pain of getting the “please may I have permission to read from your phone”. And I’ve mostly forgotten what I did.
Querying for the genre was strange, since the column was defined as not being used. It turns out that each file can have multiple genres (of course, since Dread Zeppelin are both Rock and Reggae), so once you’ve got your file you have to do another query to get the genres for that file.
Anyhow, after two morning’s work I managed to get it to play a single file from local storage. There are loads of things that don’t work, but that’s kind of the nature of software.
At this point I flailed around with libraries and gradle build files for two solid hours before I realised I didn’t have any do-able concrete aims, and this project needed a bit of rigour if it was going to advance at all.
So basically I’ve turned it in a job - organising it as a one-man scrum team, with me being product owner, scrum master and code monkey. I’ve got a basic prioritised backlog of stories which I’m sure will fill out very quickly if I continue in this vein. I haven’t bothered with estimation - it’ll take as long as it takes, and currently I don’t have a concept of a sprint. Given that the only person I’m delivering to is myself, I think sprints will basically be a couple of stories until I’m happy that whatever I’ve done is sufficiently polished.