↑↑ Home ↑ Hardware

A Linux-based hi-fi audio player

Hardware -- Software -- Mechanical -- Photos

A few brief notes on an audio player I built for my stereo. The main requirements were support for Ogg Vorbis and FLAC, and usability at a distance from my armchair. Also, I did not want to pay as much as these PC-based players cost when you buy them as a box.

Hardware components

Mainboard

VIA EPIA-LN 10000EAG. Fanless, ITX (17 x 17 cm) form factor, including C7 CPU @ 1GHz, which is more than sufficient for audio decoding. It is comparably inexpensive but still modern enough to have SATA disk interfaces.

I wasted some time debugging the drivers of the sound card before noticing that the PCI slot connections were the problem. The springs in the slot of this mainboard are so soft that the contact with the card is bad. Removing and re-inserting the card muiltiple times solves the problem.

Sound card

Echoaudio MiaMIDI. A solid but not extravagantly expensive musician/audiophile sound card. Unlike other manufacturers, Echoaudio put their specs on the web openly, and their openness about drivers (they provide a reference implementation to developers) results in good Linux support. They are compatible with both home and professional audio equipment because the analog output level and S/PDIF mode can be switched. The card is both 5V and 3.3V PCI slot compatible, even though all pictures on the web show it as a 5V only card, so don't worry.

Each of the analog I/Os transmits a single channel despite being 3-contact TRS jacks. The 3 contacts are for balanced (differential) cables in professional audio. If you (like me) want to wire it up to your home stereo, you need a pair of two-contact TRS-to-RCA cables. The drivers behind the jacks automatically sense a 2-conductor cable has been connected and will not try to drive the level between the two shorted contacts.

Power supply

A fanless laptop-style 12V power brick and a 90W PicoPSU to generate the various voltages the mainboard needs. The PicoPSU is a small board which plugs into the mainboard power connector and has a reputation for high efficiency.

Hard disk

A 320 GB Seagate Momentus 7200.3 (ST9320421AS). A 5400 RPM drive might have been quieter, but that is mostly an issue for people who live far from any church and road and other habitation, and in a room with no external walls or water pipes or mechanical wall clocks... (But see below on how I mounted the disk.)

Update: I have now replaced the hard disk by a 64GB solid-state disk (Kingston SSDNow), which is still sufficient capacity for storing all my music in FLAC format. This makes the player totally silent; it was mainly the clicking of the drive stepping the read/write heads that was annoying.

Display

Fujitsu/Siemens Scenicview E19-8 19. The cheapest and most low-quality monitor in the world. Its hue changes with the angle of view, and its sharpness is "limited", but it is sufficient when viewed at a distance, as in my case. A more serious issue is that is makes a slight high-pitched noise; but when it is mounted on the wall, fortunately not much of it is transmitted perpendicularly.

Input devices

Logitech Cordless Trackman Wheel. Unlike mice, trackballs can be used without a flat surface, and a cordless one is a remote control for graphical programs. Unfortunately they are not widely sold, and there are few models. A presentation mouse/trackball may also be suitable, but the Trackman's scroll wheel helps selecting songs from a HTML page (see below). Its reach is 2 metres or more provided you put the receiver on a horizontal surface as intended; putting it in the vertical did not work.

As for a keyboard, I have an old one connected in case of trouble, but it is not used for operating the player.

Total cost (spring 2009): 124 (MB) + 19 (RAM) + 129 (sound) + 88 (HD) + 87 (power) + 110 (display) + 56 (trackball) = 447 EUR (PC) + 166 EUR (peripherals) = 613 EUR

Power consumption: 29 W (PC) + 27 W (display) = 58 W. Switched off: 6.9 W (PC) + 0 W (!) (display)

The solid-state disk I substituted for the hard disk was 30 EUR more at a much smaller capacity. Power consumption has been reduced by about two Watts.

Software

Operating system

Gentoo Linux. Flexible enough to allow building a small system, but still manages dependencies. Downside: you have to compile everything on your local box, which takes a while.

Audio player

gmplayer. The only choice because I wanted to enlarge control elements so they could be seen/used from a distance. Other players allow theming, but not resizing or rearrangement of the control elements. My new, extra large gmplayer skin can be found here (screenshot see below). It was drawn with xfig, and then exported as a bitmap and divided up by a script using ImageMagick. The sources are included, so you can modify it.

gmplayer does not support playing all audio files in a directory when a directory is passed on the command line. Besides, selecting an album with a web browser (see next item) does not allow you to pass multiple files to an external application. This is solved by having the browser call a launch script, which calls gmplayer with a playlist of all audio files in the directory.

This script also takes care of a major disadvantage of (g)mplayer, namely that it does not support gapless playback. This is important when songs continue across track/file boundaries, as is the case for classical and some modern music. The launch script fixes this problem by making mplayer output raw PCM data to a named pipe (which it expects to be there; use mkfifo), from which the ALSA play program aplay reads. The buffering the system provides for the named pipe is sufficient to bridge the delays mplayer introduces when changing files. (See here for a stand-alone example of how this works. If you find you need more buffering, try my audio FIFO program.)

Album selection

I store all my music in the FLAC lossless compression format. It is organised in three hierarchies of directories for the genre, the band or composer and the album. To select what to play, I click on an image of the album cover in a web browser (I use links). The covers are located in the directories containing the audio files; I scanned them or found them on the web and converted them to thumbnails using this script, which uses ImageMagick. This longish Perl script generates a HTML page with cover images for each genre. It also automatically generates the files containing their own absolute paths, so that the launch script knows where to look for audio files. These files are linked to by the album covers, and the browser's file associations are set so that this file type is passed to the player launch script.

Startup and shutdown

TuxOnIce for hibernation and accordingly quick startup and shutdown. Total startup time is 22 seconds, which seems a lot. But it takes 7 seconds after the power button is pressed for the BIOS to display the first screen, and the grub menu appears at 12 seconds. At 20 seconds the display blacks out to readjust, and displays the X screen two seconds later. So more than half the startup time is due to the BIOS. A newer type of mainboard might help here. Shutting down takes some 15 seconds.

Because the MiaMIDI sound card has to have firmware loaded before it can function, its driver has to be unloaded before hibernating and reloaded after resuming. This is achieved by putting the following line into the TuxOnIce configuration file, /etc/hibernate/common.conf:

UnloadModules snd_mia

TuxOnIce is conservative and will refuse to shut down if removing a module is not successful, such as when some program is still using it. To allow shutting down even when some player is still running, I put the following lines into the common.conf:

OnSuspend 83 killall -q -KILL gmplayer || true
OnSuspend 83 killall -q -KILL mplayer || true
OnSuspend 84 killall -q -KILL aplay || true
OnSuspend 85 killall -q echomixer || true

OnResume 11 sudo -u dj -H -b /usr/bin/echomixer

This causes any player programs I use to be killed before trying to unload the sound card driver, and the Echoaudio card mixer to be relaunched on resume. The "|| true" lets the shutdown go ahead even if no process could be killed (because no player was running). The sudo starts the echomixer as a non-root user.

Audio mixer

echomixer, part of the ALSA-tools package, is a mixer program specific to Echoaudio cards. As well as setting mixer levels, it allows adjusting the card's special functions such as consumer/professional I/O modes, and displaying a VU metre.

Mechanics

Case

None, really. (You probably wouldn't want to follow my lead here.) It would be hard to get a case which fits with the sound card sticking up out of the PCI slot, and I didn't want to bother with PCI extenders. Besides, when putting a fanless mainboard in a case, a case fan is recommended, which sort of defeats the purpose of having a fanless mainboard. Also, I am not shocked by the sight of bare electronics, so I just bought an aluminum plate with a grid of holes which I bent to form a box open at two ends. The mainboard is on the top, and the hard disk and power supply inside. The power brick is stowed away there too, the reverse of the trick used by salesdroids to make a device smaller.

Hard disk

After some disappointing experiment with (too hard) rubber mounts, I hit on a simple, effective and cheap way of acoustically decoupling the hard disk from anything that might resonate with it and amplify its noise. I used short strips of 19mm climber's webbing to suspend it from the top of my home-made case. The fastening at both ends of the strips consists of screws pushed through it, which disqualifies them for climbing but is amply good enough for the negligible weight they have to support.

Display

The display is VESA mount compatible, which in this case means four M4 screw threads in its back in a 100mm square. You can buy wall mounts for such displays for 50 to 200 Euros, but unless you need pivoting, there is a simpler solution. I fastened two of the metal plates carpenters use to nail beams of wood together and which any DIY shop stocks to the back of the case (measure distances between holes before you buy) and mounted the display on the wall by suspending the plates from wall hooks on their bigger holes.

Photos


The complete system

Reduced screenshot

Big Easy gmplayer skin

The player

Hard disk mounting

Display mounting