Devious Fish
pianod History

Pianod History

pianod started in 2012 as a Pandora music client for home automation and multi-listener environments. With a line-oriented socket interface, the player could be controlled via TCP/IP sockets; telnet, nc, and a shell script were common ways to control playback. The software used an open-source library, libpiano, to interface with Pandora; pianod’s language, C, was chosen based on this library.

When WebSockets RFC 6455 were standardized, a web-based client was added. Initially this required an external program, but to simplify things WebSocket support was integrated into pianod’s communication layer (“Football”), along with a rudimentary HTTP server.

Growing complexity and a list of new features in early 2014 suggested a redesign. In October, a new architecture was planned and coding commenced, switching from C to C++. A C++ wrapper was added around the communication layer, but over time the rest of the code has been updated or refactored to better reflect C++ and the STL. Snippets of the original C code remain, especially within the Pandora source. Architecturally pianod2 changed to support new features: multiple music sources (such as a local collection and Pandora), multiple outputs (“rooms”), and integration with the open-source projects ffmpeg or libav to provide playback.

pianod2’s filesystem source takes ideas from mserv (mserv.org), and reuses an enhanced filter algorithm provided as a patch for that project. The filter turned out to be incredibly useful when performing cross-source actions, such as adding a seed to Pandora from a song playing off a local filesystem. Fulfilling requirements such as these, along with enhancements to the filter, created edit fatigue in the filter which eventually lead to refactoring it to C++, which helped clean up the code and ensure its reliability.

pianod2 was gradually fleshed out to the feature set of the original, then expanded with new features such as crossfading.

Meanwhile, libav’s evolution from the original ffmpeg code base lead to problems. Given poor documentation and support, support for it was dropped while gstreamer and AVFoundation support added. Similarly, TLS support was broadened to accept any of several popular packages.

Over time, the client’s JavaScript became awkward and difficult to maintain because of the language’s lack of error checking. The client was migrated to TypeScript, which addressed this issue and provides a far better syntax for classes and inheritance, yet transpiles into commonplace JavaScript.

Given a fair amount of native OS X support at this point, an OS X pre-packaged application, Orchid, was created using the pianod2 engine but sporting a Mac user interface and preferences pane. It was abandoned at the end of 2017 when I migrated off the Mac platform.