Reinventing the Wheel: A Better Media Player

Posted: November 22nd, 2009 | Author: | Filed under: Music, Software | Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , | No Comments »

As I’ve posted in the past, I am a picky media player user. I’ve tried most every free player under the sun, along with some not so free solutions and have yet to be entirely satisfied with any of the available products. To that end, I’ve started to think about the possibility of writing my own media player. The following are some of the considerations that I’ve been mulling over:

Base Requirements:

  • Playback of both mp3 and flac files. Support for other formats could be added as required by me or other users, possibly with us of some sort of plugin engine.
  • Some kind of a rating system, preferably with a high level of granularity. I’m not married to the standard 5-stars idea, and may explore alternative ideas, including tagging.
  • Truly smart playlists that allow for the standard global AND/OR rules, as well as more advanced expressions that support brackets and branching logic.
  • Smart importing from existing iTunes, Songbird, Media Monkey, and Windows Media Player libraries, various playlist formats, and other types of media collections.

Feature Wish List:

  • Blackberry Sync: When not at home, I listen to music from a flash card on my Blackberry Curve. The device can be filled with media by simply dumping it all on the media card, which appears as a removable drive. As previously mentioned, I listen to a mix of mp3 files and lossless flac files. When dumping these files to the Blackberry, I would like to see one thread dedicated to converting the flac files to mp3s, while another thread actually fills the device, resulting in a sync process that is not significantly slowed by media conversions. Additionally, since I have hard drive space to spare, I would like to cache some or all of the resulting mp3 files so that they don’t have to be converted again on the next sync. I would also like to see the ability to import files from the Blackberry to the library so that I could pick up media on the go and bring it home with me.
  • Library Export/Backup: With a library of 10K+ tagged and rated songs, losing the library of meta data about my music would be a traumatic experience indeed. To solve my paranoia over losing this data, I would like to implement the export of single playlists and entire libraries to all of the major playlist formats, as well as to a structured XML document, similar to the one that iTunes maintains. Some kind of automated backup feature like the one that iTunes has would also be nice.
  • Online Integration: I currently report all of my song plays to last.fm, which is an excellent resource for discovering new music. I would like my media player to link in with last.fm and other online resources, but am also open to developing my own online resource that lets users to easily compare and organize their collections, correct their meta data, and actively discover new music that other users have rated.
  • Library Sharing/Streaming: We run a large network with lots of computers, and I’d like the ability to listen to my music from anywhere in the house. I really like the work that Subsonic has done in this area, and hope to implement some or all of it’s features, while at the same time linking it into my database so that I can see my playlists and edit my meta data from anywhere in the house, and indeed, from anywhere in the world.
  • Cross-Platform and Open-Sourced: Given all of my recent experience with Debian Linux, I’d like to see my media platform running on both Windows and Linux. This one might take me awhile to accomplish, but is definitely a goal of mine, given that I am now a confirmed Linux user who still keeps a couple of Windows platforms lying around.

Implementation:

Of course, with all of these goals in mind, the next step is to consider which platform I’d like to build on. This basically comes down to a number of choices, some cross-platform, some not:

  • Visual Studio .NET: My development IDE of choice, Visual Studio provides extremely quick GUI creation and a great number of useful libraries that cut out a lot of the nitty gritty time consuming base code necessary for a project as large as a media player. Additionally, the Windows Media Player control allows for drop-in playback of media, and I have a ton of example code lying around that implements most of the features listed above. Unfortunately, while .NET 2.0 is supported on Linux under the Mono platform, I don’t know how far that support goes in terms of media management and playback.
  • SFML: The Simple Fast Media Library is available as libraries that are pre-compiled to run on Windows, Linux, and Mac, with support for Visual Studio, C/C++, Python, and Ruby. It includes packages for windowing, graphics, networking, and most importantly, audio capture and playback. This is a definite contender as it is open source, meaning that I could build the libraries directly into my code, and simply recompile for different platforms. Of course, the downside is that I’ll have to code in C++, and without any kind of graphical interface builder.
  • Juce: Jules Utility Class Extensions is like a more featured version of SFML that provides packages for just about every conceivable task, including some serious audio libraries that support all kinds of playback, effects, and hardware accelerated features. In addition, it does audio CD reading and writing out of the box on Mac and PC platforms. If I were to strike out from Visual Studio, this would probably be my library of choice, as it can do nearly everything that VS can do, but is fully open sourced and supported on just about every available platform.
  • Java: I have no idea how realistic this idea is. I do know that in the past, I’ve created Java apps that can play both wav and mp3 files, and stream those files over a network connection. That said, as much as I enjoy coding in Java, it is widely regarded as being slow and clunky – not exactly traits that I’d like associated with a media player that will be running all day. On the other hand, Java is not C/C++ (a huge bonus as far as I’m concerned), is fully object oriented, has decent audio support, and makes networking extremely easy. That said, programming GUI’s of any kind of complexity in Java is not a task to be taken on lightly.

Well, that about sums it up. This project is definitely something that I intend to undertake in the coming months, and until then, I’ll keep thinking about my requirements and what library I’d like to use to implement it. If anybody else has experience with some useful audio libraries that they’d like to share, please do so in the comments.


Post-Midterms Class Roundup

Posted: November 1st, 2008 | Author: | Filed under: Education, Software | Tags: , , , , , , , , , , | No Comments »

So midterms are finished, and life goes on. As much as I’d love this post to be tech-oriented, showcasing some brilliant new software that I’ve written in my spare time, the truth is, I haven’t had enough spare time lately in which to write any software of value.

The small exception to that claim is this app, a neat little VB and XML oriented program that allows you to read an iTunes playlist file (as exported to XML), and auto-copy all of the songs in that playlist to any folder you wish, preserving the artist/album/song file structure.

I wrote the program to fill my brand new blackberry with a selection of excellent songs, because the built in Roxio media manager is great for pictures, but slow as sin when it comes to larger media files. After writing it, I realized that it could also be a useful piracy tool; but then again, a hammer could be a positively fantastic homicide tool in the wrong hands too. Of all the libraries I’ve ever written, my .NET XML parser has spawned off more crappy little programs, making it possibly the most useful bit of code I’ve created.

Other than that, my coding has lately been limited to some cool graphics stuff in with OpenGL and C++. So far we’ve constructed a classic spinning cube implementation, complete with a custom view pipeline that implements transformations, dynamic shading, and back face culling in software. The next topic that we’re studying is texturing, and eventually, ray tracing and shaders.

While none of my assignments for this course have been interesting enough to warrant posting, I’ll definetly up my final project for the course, which at this point, is probably going to be a 3D terrain generator, similar to that of Sim City 4 fame.


Troubles with XNA

Posted: August 26th, 2008 | Author: | Filed under: Software | Tags: , , , , , , , , | 2 Comments »

I’ve always had an interest in making video games. I remember making a puzzle-based game with Microsoft Power Point way back in the day that occupied a full box of floppy discs. While the current state of the video game industry seems contrived to prevent new players from entering the scene, I’ve often toyed with the idea of trying to get involved by way of participation in a smaller project.

I’ve worked on numerous ‘bastard’ games over the years, so called because they’ve often been written in VB or Java, and usually had horrible physics or jerk rules that made them impossible to play. These have always been fun, but I recently decided that I’d like to do something a little more serious, and started looking into the MS XNA framework for Windows and XBOX 360.

I grabbed a text book on the subject, and started at it, intending to create an old-school top-down RPG similar to early Zelda titles or Pokemon a la GameBoy. So there I was trying to write a game in an unfamiliar language (having never used C# before), and with a new mindset on how games should be created. The majority of basic classes were ported over from an old VB project that I had lying around, allowing me to get a sprite and tiling system up in short order.

In order to properly test the tiling system, I decided to leave the engine for a short period and build a map editor app back in trusty old VB. I set it up so that the editor saves two files – a PNG pallete of all tiles used in the map, and an XML file that describes which image from the pallete to put on each square of the map grid. For those interested, the source code can be had here.

So now that basic maps can be created and saved, the task of loading maps into the engine is at hand. And this is where I got seriously mucked up. XNA introduced me to the idea of a Content Pipeline – essentially, my engine cannot load files from arbitrary directories on the system drive at run time. All necessary files must be dropped into the project at design time, to be compiled into a binary file that the engine will read from at run time.

Ok so not a big deal for image files – just drop them into the content folder, load them into a Texture2D object, and draw them to the screen. But how on earth do you do likewise for an XML file? In order for my engine to use the fancy map editor that I spent hours working on (and am pretty proud of), it has to process an XML file for the level, load the necessary pallete of tiles, and construct the background grid based on that information.

Sure, hardcoding the levels -would- work, but that’s ugly and stupid and horrible. I like my XML levels, and want to process them (with the content pipeline if I must) with ease. The missing link is figuring out how to open an XML file for reading that is hanging out in the content pipeline.

Anyway, that’s about as far as I’ve gotten, but I’ll keep updates coming as I get farther into my adventures with writing an RPG.

Cheers,

Jon