Building a Multi-Room Digital Music System

Use embedded Linux and open-source software to build a networked audio appliance.

Like many media buffs these days, I have a media center computer in my house. It is a small VIA M10000 Mini-ITX system in a Casetronic C158 case running Freevo on top of Gentoo Linux. It sits inside my media cabinet and serves music, video, photos and various other bits of information to my TV. The small media center gets all of its content from a much larger AMD64 Gentoo Linux server that resides in a closet near the back of the house. The two machines talk to each other over a wired network using NFS (Network File System). I will be the first to tell you that it is great to have all of my music, videos and photos in a digital format and easily accessible.

In the same spirit of my media center computer, I wanted to have a few small systems that could sit on a shelf or in a drawer that would serve music to different parts of the house. Many products on the market exist that will broadcast audio from a computer and many others will play the resulting stream. The problem with most of these, to me, is that only one stream is available. I wanted the ability to play different music in each room at the same time and control it with one device. A few newcomers to the market do exactly what I wanted—namely the Sonos Digital Music System, which was reviewed in the March 2006 issue of Linux Journal. However, I wanted to tackle this one myself.

Figure 1. The Media Center with the Nokia 770 as the Controller

My idea was to build a fanless Mini-ITX appliance that would grab content from my file server and play it using MPD (Music Player Dæmon). To control the appliance, I use lightTPD (a PHP-enabled Web server) and phpMp (a PHP application that controls MPD), running on the appliance. This gives any computer on the network with a Web browser the power to control the appliance. My controller of choice is a Nokia 770. Using Opera, which comes installed, I can point the browser to each of the appliances and control them over my wireless network.

Hardware for the Appliance

For the appliance, I chose to start with a VIA ML6000EA Mini-ITX motherboard. This board has many features that make it perfect for this type of appliance. The main one is the VIA 600MHz Eden fanless processor. This tiny processor is more than enough to push the applications, and it makes absolutely no noise. Other nice features include six-channel onboard audio, onboard LAN, support for 1GB of memory and a PCI slot.

Because I wanted the appliance to be silent, I decided to forgo a standard hard drive. Instead, I opted for a 256MB Flash drive that plugs directly in to a 40-pin IDE slot. The Flash drive also draws its power from a standard four-pin molex. I also added 256MB of DDR 400 memory to finish out the internals.

Figure 2. The Open Casetronic Case with Motherboard

To give the appliance a sleek look, I went with a Casetronic C158 case. This case has a smooth front, which makes it look more like an appliance. Even though the case has room for a slim ROM drive, I did not put one in, because MPD does not have support for playing audio from a CD. The case also has audio jacks on the front right side that provide easy access for enjoying music with headphones. Another nice feature on this case is the optional CompactFlash card reader that can be mounted from the inside and accessed right below the CD-ROM tray.

Embedded Linux

Because I chose to use a Flash-based hard drive, I needed to make sure that my Linux installation was small, less than 250MB, and did not write to the disk. Flash-based drives and disks have only a certain number of write cycles that can be preformed on them before they give out. My particular drive, made by IEI Global Sourcing, supports more than one-million cycles. Even with support for this many cycles, the drive would stop working in a fairly short amount of time due to disk writes, especially if there were a swap partition on the disk. With all of this factored in, I decided an embedded Linux system was the best fit.

Embedded Linux systems can be created in a variety of ways. I chose to go with embedded Gentoo (see Resources). Because my development machine, a Dell 600m laptop, already runs Gentoo, I didn't need to create a custom build chain. I simply could get a snapshot from the Gentoo Web site and use my laptop as a host to build the embedded system.

Before I attempted to build the system, I took a long look at Building Embedded Linux Systems by Karim Yaghmour (see Resources). This book provides a very detailed view of the exact ingredients that make up a functional Linux operating system. And, as the title states, it shows the reader how to build embedded Linux systems. I also followed the instructions written by Heath Holcomb on how to construct an embedded Gentoo system (see Resources). Heath's instructions describe all the needed steps for building an embedded Gentoo system and making it operational. Without these resources, this entire project would not have been possible. I strongly recommend you take a look at them if you are considering doing anything with embedded Linux.

It also should be noted that if you want to build an appliance like this, but would rather use a hard drive and save yourself some time, you can use almost any Linux distribution. Most of them come with all of the software for this project already in their package systems.

Building the embedded Gentoo system was not too difficult. If you have ever installed Gentoo before, making the leap into the embedded realm is not very hard. Several things did make my build interesting though.

I followed Heath's instructions to the letter, and when I was finished, I had a working embedded Gentoo system. After testing it and making sure it all worked, I went on to install the rest of the software that I needed (MPD, lightTPD and phpMp). This proved to be a bit problematic. Portage (Gentoo's package system) wanted to install several software packages that I did not want or need. So, I started over from scratch and carefully installed only the dependencies for the software I needed. Then, I installed my three pieces of software with a nodeps flag to ensure that I did not get the unwanted software.

During the build process, I tested the system several times. I wanted to make sure that with each step I was making progress and not breaking something that had worked previously. To test the system, I used a USB media reader to copy the embedded Gentoo system off my laptop onto a CompactFlash card. I then plugged the CompactFlash card in to a card reader plugged directly in to my appliance computer. This allowed me to test the appliance and emulate how it would operate once everything was working.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks for the advice. I just

Jay Taylor's picture

Thanks for the advice. I just finished building my media room. I installed an awesome flat screen and speakers. Additionally, I had the Sugarland electrician from MisterSparky-Houston come over and do all the electrical work.

tag editor

Anonymous's picture

Remember, if you'd want to use a MPD tag editor, your music would have to be mounted writable. (Maybe put the MPD into the file server and redirect its audio output over the network? ...but that, again, would mean that you only have one stream.) So it's better not to have a built-in editor, isn't it?

Handling of network connectivity

Anonymous's picture

I have a number of questions regarding the network connectivity of the appliance, but a good start would be this:

1) How were you able to get it connect connect to your network so as to access the file server as well as the run lightTPD on it?

You do not mention any thing about the network connectivity of the motherboard you chose nor the appliance in whole.

2) If you wanted to extend this architecture to support multi-media i.e. TV/video streams, what modifications would you suggest? Or would you not even suggest it.

Image?

jakev383's picture

How about a link to the image you created for the device? That would be easier than having to build an embedded distro myself.
Thanks.

Re: Image?

cfiles's picture

The simple answer why there is not an image is because I do not want to maintain it. If I knew I could help maintain something like this I would gladly post an image somewhere.

It is actually a simple procedure to put it all together, embedded or otherwise. My first crack at this was to use the exact same setup with a standard distribution. To be specific I used Fedora on a 2.5 inch hard drive. All of the packages that I used are available as RPMs.

I went embedded for a few reasons; To see if it could be done, see if I could do it, and I already had the little flash drive laying around.

If I get more requests for an image I will put one somewhere for download.

LiveCD

Erock's picture

While reading this (please keep in mind I'm kind of a n00b so if this sounds stupid just forgive and inform me pleez) it dawned on me that while you can't use a CD over MPD, couldn't you have gotten around all this "embedded" bs by using a liveCD as your OSs "hard drive"? I'd think if you could, it would probably also cut down on the wear of your flashdrive, as it wouldn't be populated by your OS at all. Interesting read nonetheless!

-E

Examining this article a lot

RJ Adams's picture

Examining this article a lot later, I really think that with the low cost and size of flash drives these days, that using flash drives that could easily be replaced is probably the best way to tackle the problem of heat.

R.J. "Link Building" Adams

Flash Drives?

chopin2256's picture

Not only do flash drives offer low heat, they are also quicker. Flash drives would not only be great for streaming video, but also streaming audio as well. This comes in handy for composers who use mid sampling techniques to record their midi compositions, as the latency would be reduced making any delays negligible.

Notation Software Music Editor & Music Maker - Personal Composer

Live CD

Alex Walker's picture

Yep, you could use a LiveCD. I would guess the disadvantages would likely be:

1) More noise - probably the key if you're building a media player
2) More power usage - if it's on most of time, power costs add up
3) More heat - I'd think the motors spinning a cdrom would run hotter than a flashdrive, which might cause problems over time.

I'm not sure that heat /

Barry Wheeler's picture

I'm not sure that heat / power / noise would be a real factor in this setup. If you look at the noise levels of the components, they are no more noisey than existing components. Maybe if it's all solidstate as some others have suggested ... using flash memory or an equivalent may be benificial.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix