Solution Sprint 1 -- BUGTunes

From BUGwiki

Jump to: navigation, search


The Problem

We like to have music while we work. Usually the music comes out of some speakers situated on top of a shelf. In the past we have used a number of audio sources for those speakers.

This works pretty well, but connecting different devices to the speakers can be tricky.

The Plan

We decided to use Jack to run send audio from the computer running mpd to a BUG located by the speakers. The first big win is that we could then move the music server into the server room and free up some desk space. And since any computer running Jack can connect to the BUG, anyone can add their computer as an audio source. We hoped we could run the whole thing wirelessly, so that we could put the speakers anywhere in the office.

We also wanted to be able to do control mpd from IRC, and have a system in place that would let us "gong" songs that we didn't like. We have a stoplight in the office, and we hoped we could also incorporate that into the system, controlling it from the BUG and using it to indicate how popular the currently playing song is.

What We Did

This page has a good overview of the steps needed to connect two computers running Jack. In our system, the BUG is the master and the computer running mpd was the slave. There's an Open Embedded package that provides Jack, though sadly not Jack2. Fortunately the newer version of Jack have a network driver called netone that is compatible with earlier versions.

On the BUG, we installed the following packages:

On the mpd server, we installed Jack2 and mpd.

To connect the two computers, we used the following commands (motherbug2 is the BUG, bugmpd is the music server):

motherbug2: jackd -d alsa -P -o 2 -n 128 -O 128
bugmpd: sudo jackd -s -d netone -i 2 -o 2 -n 128 -O 128
motherbug2: jack_netsource -H bugmpd.local
bugmpd: sudo /etc/init.d/mpd restart
motherbug2: jack_connect netjack:capture_1 system:playback_1
motherbug2: jack_connect netjack:capture_2 system:playback_2

Troubleshooting / Fixing bugmpd

First ssh root@motherbug2.local, and check to see if jack is running with

ps ax|grep jack

you should see (with different numbers on the left):

1167 ?        SLsl   3:00 jackd -d alsa -P -o 2 -n 128 -O 128
1173 ?        SLl    6:05 jack_netsource -H bugmpd.local

If BOTH of these are not listed, you should kill all jack processes with

kill `pgrep jack`

and then start the system from scratch by running jacklauncher:


Now check to see if any clients have automatically connected:


you should see


If you dont see the netjack entries, make a note of this and skip the next step (we will do it later). If you see the above output, huzzah! Run:


You will now need to open up another terminal, and ssh buglabs@bugmpd.local. In this new terminal, check to see if jack is running with:

ps ax|grep jack

You should see:

4873 pts/1    SLl+ 124:10 jackd -s -d netone -i 2 -o 2 -n 50

If not, run:

sudo nohup jackd -s -d netone -i 2 -o 2 -n 50 &

Check to see if we have automatically connected

sudo jack_lsp

You should see:


If you do not see the "system:capture" entries, you need to restart jackd and jack_netsource on motherbug2 again (start over, basically). If you do see the entries, and if you did NOT see the netjack entries in the earlier step on motherbug2, go back over to the motherbug2 terminal and run:


Then, if you do not see the "MPD" entries, run:

sudo /etc/init.d/mpd restart

and then play some music in mpd. MPD should automatically connect itself, and you should hear the music. If MPD is actually playing (and has not stalled) but you do not hear any music, you can try running the following on bugmpd:


The Good, The Bad, and The Ugly

In the end, we were able to connect the two computers and play music through the BUG.

We also now have an OSGi bundle that uses the Von Hippel module to control the stoplight.

The process of bring the system up is cumbersome. Unfortunately it relies on coordinating actions between the BUG and the mpd server. We need to look into a way to automate this process.

Wifi just wasn't fast enough to handle the amount of data we were sending, so we ended up using ethernet.

Future Improvements

Improve the process of bring up Jack and connecting the two computers.

Finish implementing the "gong" functionality.

Write a bitbake recipe that builds a newer version of Jack for the BUG.

Figure out how to let people insert plugins between the incoming audio and the outputs so that Vish can tweak the sound.

Personal tools